I have a Node.js app. In that app, a user can upload a file.
const multer = require('multer')
const upload = multer({ dest: 'uploads/' })
app.put('/files/upload', upload.single('myFile'), function(req, res) {
let fileData = req.body['myFile'];
if (fileData ) {
let commaIndex = fileData.indexOf(',');
if (commaIndex !== -1) {
fileData = fileData.substr(commaIndex+1);
// Convert file data to stream here...
}
}
});
I'm trying to figure out how to convert the fileData
to a stream. The reason I want a stream is because I'm trying to upload the file to Azure Storage. The API I'm trying to use ([createFileFromStream][1]
) requires a stream.
Thank you!