Skip to content

refactor: replace tar extraction with modern-tar - #3353

Open
ayuhito wants to merge 1 commit into
nodejs:mainfrom
ayuhito:refactor/modern-tar
Open

refactor: replace tar extraction with modern-tar#3353
ayuhito wants to merge 1 commit into
nodejs:mainfrom
ayuhito:refactor/modern-tar

Conversation

@ayuhito

@ayuhito ayuhito commented Aug 9, 2026

Copy link
Copy Markdown
Checklist
  • npm install && npm run lint && npm test passes
  • tests are included
  • documentation is changed or added
  • commit message follows commit guidelines
Description of change

Replaces tar with modern-tar. Cuts dependencies from 6 --> 1. 4MB on disk --> 95KB on disk.

image

Ref: https://npmgraph.js.org/?q=node-gyp#select=tar%407.5.22

Similar to the motivation of #3133. Thanks for everyone's time!

Comment thread lib/install.js
log.error('error while extracting tarball', code, message)
}
const extract = () => unpackTar(tarExtractDir, {
strict: true,

@ayuhito ayuhito Aug 9, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only section I'm somewhat unsure about if it may regress. I don't think the differences are large, but I do want to point it out.

The previous behavior was very strict, relying on the onwarn handler to throw. strict: true is the same thing, but there still may be minor differences on what our definitions of strict are. e.g. node-tar accepts an archive with a single EOF zero block, while modern-tar strict mode rejects it as truncated.

This is fine for the normal path from Node.js sources, but might affect --tarball and --dist-url? How do we feel about that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant