Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make multipart parser less dependent on NodeJS #956

Open
jimmywarting opened this issue Oct 21, 2023 · 2 comments
Open

Make multipart parser less dependent on NodeJS #956

jimmywarting opened this issue Oct 21, 2023 · 2 comments

Comments

@jimmywarting
Copy link
Collaborator

I would like to use the parser in basically all env. Node, deno, bun, even browser.
however it's so dependent upon NodeJS stuff.

I would like to make a feature request to make it less dependent on NodeJS.
meaning: remove node:buffer and node:stream

Buffer could be replaced with Uint8Array
and the transformer could be replaced with something that's is iterable

There is no reason why the parser couldn't or should not work with both a node:stream or a web stream coming from a ReadableStream.
they are both iterable. and both yields uint8array.

so instead of feeding/piping in data into the parser then i would suggest that it takes a iterable and read the stream.

new MultipartParser(boundary, body)

and the parser would then do something like

for await (const uint8_chunk of body) {
  ...
}
@tunnckoCore
Copy link
Member

Hey @jimmywarting! Yeah, i had that version somewhere, it's just the parser, which exposes a function. It's practically the same as your fork.

At one point i thought to make scoped packages. I even think i have mini-formidable or something like that.

The reason i not done much in the past year is that they merged Busboy into the Node core and this kinda killed my enthusiasm. But i regularly see that people are still massively using formidable with 9m+ downloads per week so..

@tunnckoCore
Copy link
Member

tunnckoCore commented Mar 10, 2024

@jimmywarting here it is https://www.npmjs.com/package/formidable-mini a thin compat layer for Formidable.

Also just the parser https://www.npmjs.com/package/formidable-parser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants