Open
Description
- require Node 10 or 12
- latest Stream APIs
pipeline(...streams, (err) => {})
- https://nodesource.com/blog/understanding-streams-in-nodejs/
- https://nodejs.org/api/stream.html
- https://www.youtube.com/watch?v=aTEDCotcn20 (Matteo Collina, NearForm, Node core)
- Readable Stream by default, Support readstreams #360 ?
- strictly only
multipart/*
? - util wrappers around iterators & async iterators
- rewrite MultipartParser class to async generator function?
- so we can
Readable.from(multipart())
?
- so we can
- compatible (make use of)
VFile
orVinyl
? v2?- battles path related things and opreatons
Okay, some thoughts.
I think we can just wrap the Node's stream.pipeline()
and provide it to our users, but they still will be able to do whatever they want, using the Node's pipeline()
. Something like this
const { pipeline, MultipartParser, formidable } = require('formidable');
// accepts a callback, or returns a promise if no cb
const { fields, files } = await pipeline(req, formidableOptions);
// if they want more transform or whatever,
// they can add more things, just like in the Node's pipeline()
const { fields, files } = await pipeline(
req,
...streams,
...iterators,
);
// or directly using the native pipeline()
const parser = new MultipartParser(); // it's Transform Stream
await promisify(stream.pipeline)(
req,
parser,
formidable(),
);