Tags: electron/asar
Tags
perf: 5-7x faster packing, 15-20% faster extraction (#414) * fix: resolve pickle resize overflow, stream flush race, and integrity block boundary bugs Added 81 robustness tests that uncovered three bugs: - Pickle resize allocated wrong buffer size, causing RangeError on large headers - writeFileListToStream/streamFilesystem didn't await stream flush before returning - Integrity hash emitted spurious empty block when file size hit exact 4MB boundary Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(test): use path.join for deeply nested path test on Windows Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(test): use os.tmpdir() instead of shared dir for Windows compatibility Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(test): use wrappedFs to bypass Electron ASAR interception Under Electron, node:fs intercepts .asar paths as virtual archives. Tests that read/write raw .asar files need original-fs via wrappedFs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * perf: optimize pack and extract performance (5-7x faster packing) Key optimizations: - Buffer-based integrity hashing for files ≤2MB (avoids stream setup overhead) - Batched writes in writeFileListToStream (single write instead of per-file) - Bulk archive read in extractAll (one readSync for entire data section) - Synchronous fast path in insertFile (eliminates Promise allocation per file) - Set-based lookups for ordering and unpackDirs (O(1) vs O(n)) - Parallel metadata resolution in createPackageFromFiles - Optimized crawl symlink filter with early exit Adds benchmark suite (yarn benchmark / yarn benchmark:quick). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci: run tests on all PRs, not just those targeting main Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * test: remove robustness-spec.ts (superseded by split spec files from #417) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fix: pickle resize overflow, stream flush race, integrity block bound… …ary (#413) * fix: resolve pickle resize overflow, stream flush race, and integrity block boundary bugs Added 81 robustness tests that uncovered three bugs: - Pickle resize allocated wrong buffer size, causing RangeError on large headers - writeFileListToStream/streamFilesystem didn't await stream flush before returning - Integrity hash emitted spurious empty block when file size hit exact 4MB boundary Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(test): use path.join for deeply nested path test on Windows Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(test): use os.tmpdir() instead of shared dir for Windows compatibility Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(test): use wrappedFs to bypass Electron ASAR interception Under Electron, node:fs intercepts .asar paths as virtual archives. Tests that read/write raw .asar files need original-fs via wrappedFs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
feat: add integrity digest management commands and functionality (#380) * feat: add integrity digest management commands and functionality * fix: don't export functions that don't need to be exported * fix: run prettier * chore: reset yarn.lock to main * chore: use full version for caret range * style: add comment for sentinel value * refactor: extract digest calculations into generic function * docs: clarify platform requirements for new command * refactor: flip argument order for `integrity-digest` command * docs: add documentation for integrity digest feature * style: add cleaner type checking for integrity calculator * refactor: make calculation, getting, and storing of integrity digest to be API * style: fix linting issues * docs: clarify message when encountering unexpected integrity digest version * yarn up minimatch and tar * refactor: validate integrity information before calculating hash * refactor: use custom errors for itegrity digest and export them as API * refactor: make get and set integrity digest functions sync instead of async * fix: fix inverted logic test in ASAR integrity validation * test: add integration test for integrity digest * test: add environment variables for itegration test * style: clarify integrity digest cli switch statement Co-authored-by: David Sanders <dsanders11@ucsbalum.com> * refactor: use `node:timers/promises` for sleep instead of `promisify` * refactor: change style of defining custom errors and export remaining error * style: make linter happy again * fix: add additional skip path to integrity digest integration test * revert yarn.lock * reapply lockfile changes * refactor: adjusted electron version checks in integrity digest integration test * style: make linter happier yet again * style: remove unneeded whitespace in comment Co-authored-by: David Sanders <dsanders11@ucsbalum.com> --------- Co-authored-by: Erick Zhao <erick@hotmail.ca> Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
feat!: bump `engines` requirement to Node 22 (#347) BREAKING CHANGE: bumps required Node.js version to >=22.12.0. ESM-only. * use `node:` imports * use `"@tsconfig/node22` * remove `rimraf` * update `glob` and remove inlined types * esm: add `"type": "module"` and update imports * esm: update test imports and dependencies * remove `default` exports * remove unused `import`s * fix Windows tests * update `import`s / `export`s in `src/asar.ts` * remove `promisify(stream.pipeline)` * remove `lodash` * remove `enginesStrict` * rename `bin/asar.js` to `bin/asar.mjs` * bump `minimatch` to `10.0.1` * `var` -> `const` * add `noUnusedLocals: true` to `tsconfig.json` * update `wrappedFs` * update `commander` * update `chai` * add docs publishing flow * docs: update README imports --------- Co-authored-by: Erick Zhao <erick@hotmail.ca>
fix: allow `../` symlink Streams when they're still within the package ( #363) * fix: allow symlinks that point to higher directories but still validate that they are within the filesystem * add invalid symlink to test readstream failure on outside package * add additional test for bad symlink fixture
feat: add in-memory API for streaming files to destination asar (#360) * feat: adding `async function createPackageFromStreams(dest: string, filestreams: Filestream[])` to allow streaming files directly from in-memory into the asar. The stream order is used as the insertion order. Consolidated logic for generating Pickle `out` `WriteableStream` and creating unpacked symlinks * Refactor Type definitions for handling streaming to asar * Update src/filesystem.ts Co-authored-by: Kevin Cui <github@bugs.cc> --------- Co-authored-by: Kevin Cui <github@bugs.cc>
feat: allow providing properties (such as `unpack`) in `ordering` inp… …ut file (#350) * Part 1 for electron/universal#117 with updated unit test * add additional helper function * use wrapped-fs for writeFile * `yarn prettier:write` * swap to for-of loop and extract helper function `isAlreadySorted` to make it more readable
PreviousNext