feat: Allow large uploads via Blob - #598
Conversation
|
🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review. Tip
Note Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect. Caution Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code. |
|
Warning Review limit reached
Next review available in: 55 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Issue
Closes: #228
A
Blobhanded tocreateFilehas nopipe, so it misses the streaming path added in #459 and is passed toPutObjectCommandwhole. That materializes the entire file in memory, which is exactly what fails for uploads past the V8 buffer limit, the case #228 is about.Picks up #229 by @dalyaidan1, which implemented this against the v2 SDK. @vahidalizad asked there for it to be redone on v3 after #221 landed, and it was never revisited. This is that rewrite, and it is much smaller now, because #459 already added the multipart upload path that the blob only needs routing into.
Approach
Anything exposing a web stream, a
Blobor aFile, is converted to aReadablebefore the params are built, so the existingUploadpath carries it:Duck typed on
stream()rather thaninstanceof Blob, so aFile, a blob from another realm, or a polyfill all work. Thepipecheck keeps a NodeReadableon its existing path untouched.The original PR built its own
PassThroughand piped into it. That is no longer needed:Uploadaccepts aReadabledirectly and handles the multipart chunking, so this adds no plumbing of its own.Behavior
Blobnow streams to S3 in parts instead of being buffered, so memory use is bounded by the part size rather than by the file size.Bufferand string bodies are unchanged and still usePutObjectCommand.Readablebodies are unchanged.Tests
spec/test.spec.jsgains ablob uploadsblock: a blob takes the multipart path rather thanPutObjectCommand, the upload is handed aReadablerather than the blob, the contents survive the conversion, and the source is not drained by the conversion itself, which is the property that makes an oversized file possible at all.All four fail against the current implementation. Full suite passes.