Skip to content

Instantly share code, notes, and snippets.

Created Dec 19, 2019
What would you like to do?
const express = require("express");
const bp = require("body-parser");
const port = 5000;
const app = express();
const fs = require("fs");
const multer = require("multer");
app.use(bp.urlencoded({ extended: false }));
var storage = multer.memoryStorage();
var uploadMem = multer({ storage: storage });"/fileuploadmem", uploadMem.single("image"), (req, res) => {
fs.writeFileSync('./'+req.file.originalname , req.file.buffer)
console.log(" file mem uploaded");
res.send("file mem upload success");
app.listen(port, () => {
console.log("Express server listning on port " + port);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment