Repository navigation
docs(node): note openAsBlob bugs with files over 2 GiB - #1879
Merged
Merged
Conversation
TmpFile is backed by fs.openAsBlob, whose size is truncated above 4 GiB and whose slice() is unreliable above 2 GiB. Whole-file reads stay correct, so streaming a huge upload works while size and random access need the backing path instead.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Added a
:::warningadmonition to the Tmp File Upload plugin docs (tmp-file-upload.mdx) notingfs.openAsBlob's bugs with files over 2 GiB:sizewraps modulo 4 GiB andslice()is unreliable above 2 GiB, while whole-file reads likestream()stay correct, with advice to stat/readTmpFile.pathdirectly. - Added a matching
@remarksJSDoc block on theTmpFileclass intmp-file-upload-handler-plugin.ts, linking the same upstream issue and pointing size/random-access needs atpath.
I cross-checked every technical claim against the linked upstream issue (nodejs/node#52585): a 5 GiB file reporting size as 1 GiB matches the modulo-4-GiB uint32 wrap described there, and the slice() failure around the 2 GiB boundary matches exactly. The stream()-stays-correct and stat-the-path guidance is sound. Well-written, accurate documentation with no behavioral surface.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
More templates
@orpc/ai-sdk
@orpc/arktype
@orpc/bun
@orpc/client
@orpc/cloudflare
@orpc/contract
@orpc/experimental-effect
@orpc/evlog
@orpc/hibernation
@orpc/json-schema
@orpc/nest
@orpc/next
@orpc/node
@orpc/openapi
@orpc/opentelemetry
@orpc/pinia-colada
@orpc/pino
@orpc/publisher
@orpc/ratelimit
@orpc/server
@orpc/shared
@orpc/swr
@orpc/tanstack-query
@orpc/trpc
@orpc/valibot
@orpc/zod
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

TmpFileis backed by Node'sfs.openAsBlob, which misreports very large files. The Tmp File Upload plugin docs and theTmpFileJSDoc now warn about it, so users spooling multi-gigabyte uploads know which parts of theFileAPI they can trust.Verified on Node v22.23.2 with a sparse 5 GiB file:
sizereports the true size modulo 4 GiB (5 GiB comes back as 1 GiB, a uint32 truncation), aslice()spanning the 2 GiB boundary returns an empty blob, andstream()delivers every byte correctly. Tracked upstream at nodejs/node#52585, still open.Docs
Whole-file streaming of huge uploads keeps working as documented. Handlers that need the size of, or random access into, such an upload are pointed at the
TmpFile.pathto stat or read directly.Testing
pnpm docs:validatepasses: no JSDoc backlink errors across 204 symbols and 315 orpc.dev links, andblume validate --strictreports no broken links.