[build-utils] Improve memory efficiency in FileBlob.fromStream()#14701
Merged
[build-utils] Improve memory efficiency in FileBlob.fromStream()#14701
Conversation
🦋 Changeset detectedLatest commit: fb6d1b7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
9da4eb1 to
fb6d1b7
Compare
Contributor
📦 CLI Tarball ReadyThe Vercel CLI tarball for this PR is now available! Quick TestYou can test this PR's CLI directly by running: npx https://vercel-mor0v18s4.vercel.sh/tarballs/vercel.tgz --helpUse in vercel.jsonTo use this CLI version in your project builds, add to your {
"build": {
"env": {
"VERCEL_CLI_VERSION": "vercel@https://vercel-mor0v18s4.vercel.sh/tarballs/vercel.tgz"
}
}
} |
Contributor
🧪 Unit Test StrategyComparing: Strategy: Code changed outside of a package - running all unit tests Affected packages - 41 (100%)
Results
This comment is automatically generated based on the affected testing strategy |
ali-vercel
approved these changes
Feb 5, 2026
Merged
jeffsee55
pushed a commit
that referenced
this pull request
Feb 6, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @vercel/frameworks@3.17.0 ### Minor Changes - Add experimental Go runtime framework preset. ([#14865](#14865)) This adds support for deploying standalone Go HTTP servers (using `package main` with `func main()`) in addition to the existing serverless function pattern. The preset supports: - `main.go` at project root (simple projects) - `cmd/api/main.go` (API servers) - `cmd/server/main.go` (HTTP servers) The Go application must listen on the port specified by the `PORT` environment variable. ## @vercel/go@3.4.0 ### Minor Changes - Add experimental Go runtime framework preset. ([#14865](#14865)) This adds support for deploying standalone Go HTTP servers (using `package main` with `func main()`) in addition to the existing serverless function pattern. The preset supports: - `main.go` at project root (simple projects) - `cmd/api/main.go` (API servers) - `cmd/server/main.go` (HTTP servers) The Go application must listen on the port specified by the `PORT` environment variable. ## @vercel/backends@0.0.29 ### Patch Changes - Updated dependencies \[[`fc357e11cb4b00ab8ec413a0ea3586a87e733f0e`](fc357e1), [`ff320caa5c8a0857aad0b989699207a6a703256f`](ff320ca)]: - @vercel/build-utils@13.3.2 ## @vercel/build-utils@13.3.2 ### Patch Changes - Improve memory efficiency in `FileBlob.fromStream()` by avoiding unnecessary buffer copies when chunks are already Buffers ([#14701](#14701)) - [services] build time service url env vars ([#14893](#14893)) - Updated dependencies \[[`7a747344dfb778a650da2ee5f7fba8c974098b42`](7a74734)]: - @vercel/python-analysis@0.3.1 ## @vercel/cervel@0.0.16 ### Patch Changes - Updated dependencies \[]: - @vercel/backends@0.0.29 ## vercel@50.12.2 ### Patch Changes - Add source and defaultResourceName query params to legacy integration add web UI path ([#14868](#14868)) - [services] build time service url env vars ([#14893](#14893)) - Updated dependencies \[[`fc357e11cb4b00ab8ec413a0ea3586a87e733f0e`](fc357e1), [`84f121190813b2840a6a16279dcaa75dcb2872cd`](84f1211), [`ff320caa5c8a0857aad0b989699207a6a703256f`](ff320ca)]: - @vercel/build-utils@13.3.2 - @vercel/go@3.4.0 - @vercel/backends@0.0.29 - @vercel/elysia@0.1.31 - @vercel/express@0.1.40 - @vercel/fastify@0.1.34 - @vercel/h3@0.1.40 - @vercel/hono@0.2.34 - @vercel/hydrogen@1.3.5 - @vercel/koa@0.1.14 - @vercel/nestjs@0.2.35 - @vercel/next@4.15.23 - @vercel/node@5.5.32 - @vercel/python@6.6.0 - @vercel/redwood@2.4.9 - @vercel/remix-builder@5.5.10 - @vercel/ruby@2.2.5 - @vercel/rust@1.0.5 - @vercel/static-build@2.8.33 ## @vercel/client@17.2.35 ### Patch Changes - Updated dependencies \[[`fc357e11cb4b00ab8ec413a0ea3586a87e733f0e`](fc357e1), [`ff320caa5c8a0857aad0b989699207a6a703256f`](ff320ca)]: - @vercel/build-utils@13.3.2 ## @vercel/elysia@0.1.31 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.5.32 ## @vercel/express@0.1.40 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.5.32 - @vercel/cervel@0.0.16 ## @vercel/fastify@0.1.34 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.5.32 ## @vercel/fs-detectors@5.8.2 ### Patch Changes - Updated dependencies \[[`84f121190813b2840a6a16279dcaa75dcb2872cd`](84f1211)]: - @vercel/frameworks@3.17.0 ## @vercel/gatsby-plugin-vercel-builder@2.0.131 ### Patch Changes - Updated dependencies \[[`fc357e11cb4b00ab8ec413a0ea3586a87e733f0e`](fc357e1), [`ff320caa5c8a0857aad0b989699207a6a703256f`](ff320ca)]: - @vercel/build-utils@13.3.2 ## @vercel/h3@0.1.40 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.5.32 ## @vercel/hono@0.2.34 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.5.32 ## @vercel/koa@0.1.14 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.5.32 ## @vercel/nestjs@0.2.35 ### Patch Changes - Updated dependencies \[]: - @vercel/node@5.5.32 ## @vercel/node@5.5.32 ### Patch Changes - Updated dependencies \[[`fc357e11cb4b00ab8ec413a0ea3586a87e733f0e`](fc357e1), [`ff320caa5c8a0857aad0b989699207a6a703256f`](ff320ca)]: - @vercel/build-utils@13.3.2 ## @vercel/python-analysis@0.3.1 ### Patch Changes - fix ESM/CJS cross-compatibility ([#14869](#14869)) ## @vercel/static-build@2.8.33 ### Patch Changes - Updated dependencies \[]: - @vercel/gatsby-plugin-vercel-builder@2.0.131 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Summary
FileBlob.fromStream()when stream chunks are alreadyBufferinstancesDetails
The previous implementation always called
Buffer.from(chunk), which copies data even whenchunkis already aBuffer. For a 100MB file with 64KB chunks, this created ~1,600 unnecessary buffer copies, effectively doubling memory usage during stream collection.The fix adds a
Buffer.isBuffer()check to only copy when necessary (e.g., when chunks are strings or other types).