@keep-lts/extract-zip
v2.0.2
Published
Security-maintained drop-in fork of extract-zip. Patches CVE-2026-56876 and CVE-2026-19693 (symlink path traversal / arbitrary file write): symlinks may only point inside the target directory, and files are never written through a symlink. Original API un
Maintainers
Readme
@keep-lts/extract-zip
Security-maintained, drop-in fork of
extract-zip.
[!IMPORTANT] Unofficial security-maintenance fork. The original
extract-ziphas no fix for CVE-2026-56876 / CVE-2026-19693 / GHSA-jmr9-qjv8-65gv / GHSA-7pqw-9j4j-h8q3 (High). This fork applies a minimal, tested patch and keeps the public API byte-for-byte compatible. Adopt with zero code changes via npmoverrides:{ "overrides": { "extract-zip": "npm:@keep-lts/extract-zip@^2.0.2" } }See SECURITY.md and CHANGELOG.md. Original functionality and attribution preserved under the BSD-2-Clause license.
extract-zip
Unzip written in pure JavaScript. Extracts a zip into a directory. Available as a library or a command line program.
Uses the yauzl ZIP parser.
Installation
Make sure you have Node 10 or greater installed.
Get the library:
npm install extract-zip --saveInstall the command line program:
npm install extract-zip -gJS API
const extract = require('extract-zip')
async function main () {
try {
await extract(source, { dir: target })
console.log('Extraction complete')
} catch (err) {
// handle any errors
}
}Options
dir(required) - the path to the directory where the extracted files are writtendefaultDirMode- integer - Directory Mode (permissions), defaults to0o755defaultFileMode- integer - File Mode (permissions), defaults to0o644onEntry- function - if present, will be called with(entry, zipfile), entry is every entry from the zip file forwarded from theentryevent from yauzl.zipfileis theyauzlinstance
Default modes are only used if no permissions are set in the zip file.
CLI Usage
extract-zip foo.zip <targetDirectory>If not specified, targetDirectory will default to process.cwd().

