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
7k stars 680 forks source link

Get file as Buffer #906

Closed sboudouk closed 1 year ago

sboudouk commented 1 year ago

Support plan

Context

What problem are you trying to solve?

Thanks for the insane work behind formidable, it really a life changer. I just wanted to know or ask if there is a feature planned to make the file available as Buffers like multer do, instead of having to read them, then make a buffer.

If there is already a way it would be great to have an exemple for achieving this, and I would be glad to do a PR to add it to the documentation. I've searched on existing issues and played a bit with fileWriteStreamHandler but with no success.

Thanks for your help and your valuable work.

Do you have a new or modified API suggestion to solve the problem?

Add a file.buffer or file.toBuffer method to the file/volatilefile object , or if this is already possible, snippet to the documentation.

Thanks.

GrosSacASac commented 1 year ago

See https://github.com/node-formidable/formidable/blob/master/examples/forceBuffer.js

GrosSacASac commented 1 year ago

Please help review this PR https://github.com/node-formidable/formidable/pull/855