Answer the question
In order to leave comments, you need to log in
How to properly process a request to node.js using multiparty?
For educational purposes, I decided to write an image compressor. I was not familiar with node.js before.
Link to the code on github I
upload images using multiparty.
I ran into a problem: when processing a request, the node falls out with an error:
Error form: Error: stream ended unexpectedly
at Form.<anonymous> (/projects/node/fileupload/node_modules/multiparty/index.js:754:24)
at emitNone (events.js:91:20)
at Form.emit (events.js:185:7)
at finishMaybe (_stream_writable.js:515:14)
at endWritable (_stream_writable.js:525:3)
at Form.Writable.end (_stream_writable.js:490:5)
at IncomingMessage.onend (_stream_readable.js:511:10)
at IncomingMessage.g (events.js:291:16)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
Answer the question
In order to leave comments, you need to log in
Solved the problem.
Used express-fileupload
( example ) instead multiparty
of and set in ajax request contentType: false
instead of contentType: multipart/form-data
.
Try using busboy instead of multiparty. Also check the application for CORS headers if an OPTION request is sent
the easiest option. Bodyparser and pull out chunks from the body. Push to the array and get it later. All picture is
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question