Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Flight Reply] Encode binary streams as a single collapsed Blob (#28986)
Based on #28893. For other streams we encode each chunk as a separate form field which is a bit bloated. Especially for binary chunks since they also have an indirection. We need some way to encode the chunks as separate anyway. This way the streaming using busboy actually allows each chunk to stream in over the network one at a time. For binary streams the actual chunking is not important. The chunks can be split and recombined in whatever size chunk makes sense. Since we buffer the entire content anyway we can combine the chunks to be consecutive. This PR does that with binary streams and also combine them into a single Blob. That way there's no extra overhead when passing through a binary stream. Ideally, we'd be able to just use the stream from that one Blob but Node.js doesn't return byob streams from Blob. Additionally, we don't actually stream the content of Blobs due to the layering with busboy atm. We could do that for binary streams in particular by replacing the File layering with a stream and resolving each chunk as it comes in. That could be a follow up. If we stop buffering in the future, this set up still allows us to split them and send other form fields in between while blocked since the protocol is still the same.
- Loading branch information