multer

nodejs multer diskstorage to delete file after saving to disk

放肆的年华 提交于 2020-12-30 07:38:29
问题 I am using multer diskstorage to save a file to disk. I first save it to the disk and do some operations with the file and then i upload it to remote bucket using another function and lib. Once the upload is finished, i would like to delete it from the disk. var storage = multer.diskStorage({ destination: function (req, file, cb) { cb(null, '/tmp/my-uploads') }, filename: function (req, file, cb) { cb(null, file.fieldname + '-' + Date.now()) } }) var upload = multer({ storage: storage })

“message”: “ENOENT: no such file or directory, open 'E:\\astrology\\utils\\uploads\\1600798534862qf.png'”

[亡魂溺海] 提交于 2020-12-15 08:35:30
问题 As the title suggests, I am getting error: {"message": "ENOENT: no such file or directory, open 'E:\\astrology\\utils\\uploads\\1600798534862qf.png'"} in my project even after passing every required configs. Note: I've divided 'app' into two parts: main 'app.js' and 'appRoute.js' for more dynamic and code clarity. app.js const express = require("express"); const path = require("path"); const app = express(); const directory = path.join(__dirname, "utils/uploads"); app.use("/uploads", express

“message”: “ENOENT: no such file or directory, open 'E:\\astrology\\utils\\uploads\\1600798534862qf.png'”

倾然丶 夕夏残阳落幕 提交于 2020-12-15 08:35:16
问题 As the title suggests, I am getting error: {"message": "ENOENT: no such file or directory, open 'E:\\astrology\\utils\\uploads\\1600798534862qf.png'"} in my project even after passing every required configs. Note: I've divided 'app' into two parts: main 'app.js' and 'appRoute.js' for more dynamic and code clarity. app.js const express = require("express"); const path = require("path"); const app = express(); const directory = path.join(__dirname, "utils/uploads"); app.use("/uploads", express