Cap the cache download chunk to 2 GB

This commit is contained in:
Ashwin Sangem authored and GitHub committed 2022-03-23 16:44:40 +05:30
1 parent 8c27220ee1
commit 6df9950b6c
1 file changed
+2 -1
+2 -1
View File
@@ -240,7 +240,8 @@ export async function downloadCacheStorageSDK(
//
// If the file exceeds the buffer maximum length (~1 GB on 32-bit systems and ~2 GB
// on 64-bit systems), split the download into multiple segments
const maxSegmentSize = buffer.constants.MAX_LENGTH
// ~2 GB = 2147483647, beyond this, we start getting out of range error. So, capping it accordingly.
const maxSegmentSize = Math.min(2147483647, buffer.constants.MAX_LENGTH)buffer.constants.MAX_LENGTH
const downloadProgress = new DownloadProgress(contentLength)
const fd = fs.openSync(archivePath, 'w')