Repository navigation
Support downloading and extracting mods larger than 2GB - #2306
Open
Aaronlonin wants to merge 1 commit into
Open
Aaronlonin wants to merge 1 commit into
Aaronlonin wants to merge 1 commit into
Conversation
- Replace adm-zip with unzipper in zip-hook.ts for archive extraction and entry inspection, eliminating the Node.js 2 GiB fs.readFileSync buffer limit (ERR_FS_FILE_TOO_LARGE) - Stream online mod downloads directly to disk in the main process via Node streams instead of buffering into memory with responseType: 'arraybuffer' in Chromium - Expose downloadFile through FsProvider and node-fs IPC with real-time download progress tracking
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.
Description
Resolves an issue where mod files larger than 2 GiB fail to download or import into r2modman.
Root Causes
adm-zipuses synchronousfs.readFileSyncunder the hood to read entire zip files into memory buffers. When reading files larger than 2 GiB, Node.js throwsRangeError [ERR_FS_FILE_TOO_LARGE]: File size (...) is greater than 2 GiB.BetterThunderstoreDownloader, mod archives were downloaded in the Chromium renderer process usingaxioswithresponseType: 'arraybuffer'. Chromium's V8 engine capsArrayBufferallocations at 2 GB, causing large downloads to abort with an allocation or network error.Changes
unzipper:adm-zipusage insrc-electron/ipc/zip-hook.tsfor extraction and entry enumeration with streamingunzipper(unzipper.Open.file/unzipper.Open.buffer).adm-zipexclusively for creating new zip archives (e.g. profile exports).downloadFileto main IPC (src-electron/ipc/node-fs-impl.ts), streaming HTTP response streams directly to the target destination on disk usingstream/promises.pipeline.downloadFilethrough the preload bridge (node-fs.ts) andFsProvider(NodeFsImplementation,NodeFs, and test stubs).BetterThunderstoreDownloaderto stream downloads directly to disk in the cache folder rather than buffering multi-gigabyte files in renderer memory.Testing
npm run typecheck(vue-tsc --noEmit).npm test).Magic_Wesley-Wesleys_Moons-7.0.17.zip(~2.58 GB).Closes #617
Closes #1957