IncomingForm end event emitted twice (at least)
See original GitHub issueSupport plan
- Which support plan is this issue covered by? Community
- Currently blocking your project/work? no
- Affecting a production system? yes
Context
- Node.js version: v14 and v16 at least
- Release Line of Formidable: Current
- Formidable exact version: 2.0.1 (npm)
- Environment: node, macOS and Linux, does not matter
- Used with (popular names of modules): express
What are you trying to achieve or the steps to reproduce?
let form = new formidable.IncomingForm();
form.on("field", (field, value) => {
console.log("field", field, value);
});
form.on("end", () => {
console.log("end");
});
What was the result you got?
Printed “end” twice.
What result did you expect?
Print “end” once. I tested with a simple Postman form with 2 fields.
I bypassed the error using form.once("end")
but this doesn’t feel right.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:13 (5 by maintainers)
Top Results From Across the Web
'end' event from readstream is emitted twice - node.js
I'm using similar code, although I'm watching for the close event on the writable stream, instead of the end stream of the readable...
Read more >Formidable - npm
Emitted when the request was aborted by the user. Right now this can be due to a 'timeout' or 'close' event on the...
Read more >Events | Node.js v19.3.0 Documentation
When an error occurs within an EventEmitter instance, the typical action is for an 'error' event to be emitted. These are treated as...
Read more >Node.js in Action
side of the event loop (outside the main script execution) and then an “event” is emit- ted when the I/O is finished,6 which...
Read more >formidable
Support filename="" in multipart parts; Explain unexpected end() errors in parser better. Note: Starting with this version, formidable emits 'file' events ...
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
@marcorocci true but the library should also not emit end twice to begin with
Same issue happened with me also. I am also using the same version -
2.0.1