node-formidable / formidable

The most used, flexible, fast and streaming parser for multipart form data. Supports uploading to serverless environments, AWS S3, Azure, GCP or the filesystem. Used in production.
MIT License
7.01k stars 680 forks source link

How to halt formidable.parse #457

Open arnabsarkardhn opened 6 years ago

arnabsarkardhn commented 6 years ago

trying to build a service which will call AWS to load multiple images and return the AWS keys to the client. Here I am using Promise.all() to complete all the AWS call and get the AWS keys and then return the bunch of keys to the client.

I am using formidable. how do we halt the formidable.parse until the PromiseAll is complete?

xarguments commented 6 years ago

This is related to #471 feature request. Callback of form.parse is called when all of the files are uploaded. You can use form.onPart(), which is called before uploading files, and try to pause somehow there (depends on details of your implementation)

tunnckoCore commented 6 years ago

You can use form.onPart(),

Or the standard Events API, form.on('part', handler) and throw Error from the handler? https://github.com/felixge/node-formidable/issues/471#issuecomment-399753890

tunnckoCore commented 2 years ago

Why it sounds to me like #503... hmm.

Ok. If someone has ideas, we are open. Maybe #388 could fix this? It's pretty old but..