fileWriteStreamHandle doesn't call the passed function in express
See original GitHub issueAvantages
const { PassThrough } = require("stream");
const aws = require("aws-sdk");
const s3 = new aws.S3({
apiVersion: "2006-03-01",
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
});
function uploadFile(req, res, next) {
const uploadStream = (filename) => {
const pass = PassThrough();
/* This method is not being called*/
console.log('uploadStream() called);
s3.upload(
{
Bucket: process.env.AWS_BUCKET,
Key: filename,
Body: pass,
},
(err, data) => {
console.log(err, data);
if (err) {
console.log(err);
}
console.log(data);
}
);
return pass;
};
var form = formidable({
maxFileSize: 5 * 1024 * 1024,
minFileSize: 1,
allowEmptyFiles:false,
fileWriteStreamHandler: uploadStream // This method is not being called
});
}
I have followed the example in link https://github.com/node-formidable/formidable/blob/master/examples/store-files-on-s3.js
Issue Analytics
- State:
- Created 3 years ago
- Comments:20 (11 by maintainers)
Top Results From Across the Web
fileWriteStreamHandle doesn't call the passed function in ...
A node.js module for parsing form data, especially file uploads. See More. Top Supporters. This team needs your support!
Read more >Node.js Express - app.all("*", func) doesn't get called when ...
to call the function doSomething on every page load, but it doesn't completely work. The function fires on every page load, except for...
Read more >5.x API - Express.js
If not a function, type option is passed directly to the type-is library and this can be an extension name (like json ),...
Read more >Using Express.js Routes for Promise-based Error Handling
js ) and pass async errors to it using the next callback. Our basic error middleware setup would use a simple anonymous function:...
Read more >How to Build Middleware for Node.js: A Complete Guide - Turing
When the active middleware function doesn't stop the request-response cycle, it will call the next() function to pass on the control to the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
How ?
@sinoon there is a published canary/v2 (npm i formidable@canary) from May 2020 with all the updates. Pushed to master since then isn’t published. I’m getting my machine setup this week.