Skip to content

Conversation

@Nyoxis
Copy link

@Nyoxis Nyoxis commented Oct 17, 2025

This PR implements native ReadableStream support for multipart parts, aiming to align streaming with standard web streams and the Fetch API.

This is a breaking change intended to improve streaming efficiency and API consistency.

Please refer to the related discussion for design rationale, trade-offs, and ongoing feedback: #10781

Also aware of another multipart streaming PR implementing a callback-based chunking approach: #10764

Feedback is welcome, especially regarding API design and backward compatibility.

@mjackson
Copy link
Member

The current design of the parser is to buffer each part as it is read from the stream because buffers are easier to work with in many instances. Servers that rely on multipart-parser for parsing multipart Request bodies should have enough memory to buffer a single part of the request payload at a time. For the majority of servers and workloads, this should not be a problem. Even highly constrained worker environments like Cloudflare Workers offer 128MB.

You can use the maxFileSize option to limit the maximum size of file uploads so you don't exhaust the memory on your server.

@mjackson mjackson closed this Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants