@vercel/build-utils
Advanced tools
Comparing version 8.6.0 to 8.7.0
# @vercel/build-utils | ||
## 8.7.0 | ||
### Minor Changes | ||
- Support splitting archive deployments in parts. ([#12671](https://github.com/vercel/vercel/pull/12671)) | ||
## 8.6.0 | ||
@@ -4,0 +10,0 @@ |
/// <reference types="node" /> | ||
export default function streamToBuffer(stream: NodeJS.ReadableStream): Promise<Buffer>; | ||
export declare function streamToBufferChunks(stream: NodeJS.ReadableStream, chunkSize?: number): Promise<Buffer[]>; |
@@ -31,3 +31,4 @@ "use strict"; | ||
__export(stream_to_buffer_exports, { | ||
default: () => streamToBuffer | ||
default: () => streamToBuffer, | ||
streamToBufferChunks: () => streamToBufferChunks | ||
}); | ||
@@ -58,1 +59,31 @@ module.exports = __toCommonJS(stream_to_buffer_exports); | ||
} | ||
const MB = 1024 * 1024; | ||
async function streamToBufferChunks(stream, chunkSize = 100 * MB) { | ||
const chunks = []; | ||
let currentChunk = []; | ||
let currentSize = 0; | ||
for await (const chunk of stream) { | ||
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk); | ||
let offset = 0; | ||
while (offset < buffer.length) { | ||
const remainingSpace = chunkSize - currentSize; | ||
const sliceSize = Math.min(remainingSpace, buffer.length - offset); | ||
currentChunk.push(buffer.slice(offset, offset + sliceSize)); | ||
currentSize += sliceSize; | ||
offset += sliceSize; | ||
if (currentSize >= chunkSize) { | ||
chunks.push(Buffer.concat(currentChunk)); | ||
currentChunk = []; | ||
currentSize = 0; | ||
} | ||
} | ||
} | ||
if (currentChunk.length > 0) { | ||
chunks.push(Buffer.concat(currentChunk)); | ||
} | ||
return chunks; | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
streamToBufferChunks | ||
}); |
@@ -13,3 +13,3 @@ import FileBlob from './file-blob'; | ||
import { getLatestNodeVersion, getDiscontinuedNodeVersions, getSupportedNodeVersion } from './fs/node-version'; | ||
import streamToBuffer from './fs/stream-to-buffer'; | ||
import streamToBuffer, { streamToBufferChunks } from './fs/stream-to-buffer'; | ||
import debug from './debug'; | ||
@@ -22,3 +22,3 @@ import getIgnoreFilter from './get-ignore-filter'; | ||
import { validateNpmrc } from './validate-npmrc'; | ||
export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, getNodeBinPaths, getSupportedNodeVersion, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, streamToBuffer, debug, isSymbolicLink, isDirectory, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, }; | ||
export { FileBlob, FileFsRef, FileRef, Lambda, NodejsLambda, createLambda, Prerender, download, downloadFile, DownloadedFiles, getWriteableDirectory, glob, GlobOptions, rename, spawnAsync, getScriptName, installDependencies, runPackageJsonScript, execCommand, spawnCommand, walkParentDirs, getNodeBinPath, getNodeBinPaths, getSupportedNodeVersion, runNpmInstall, runBundleInstall, runPipInstall, runShellScript, runCustomInstallCommand, getEnvForPackageManager, getNodeVersion, getPathForPackageManager, getLatestNodeVersion, getDiscontinuedNodeVersions, getSpawnOptions, getPlatformEnv, getPrefixedEnvVars, streamToBuffer, streamToBufferChunks, debug, isSymbolicLink, isDirectory, getLambdaOptionsFromFunction, scanParentDirs, getIgnoreFilter, cloneEnv, hardLinkDir, traverseUpDirectories, validateNpmrc, }; | ||
export { EdgeFunction } from './edge-function'; | ||
@@ -25,0 +25,0 @@ export { readConfigFile } from './fs/read-config-file'; |
{ | ||
"name": "@vercel/build-utils", | ||
"version": "8.6.0", | ||
"version": "8.7.0", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is too big to display
1350675
31099