Skip to content

Make multipart parser less dependent on NodeJS #956

@jimmywarting

Description

@jimmywarting

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) {
  ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions