Index of every page on this site: llms.txt
All skills
jasnell avatar

/node-zip

@5f83e6c
Run it yourself

Node.js now has built-in ZIP archive support in node:zlib, with no npm dependency. Use whenever Node.js code must create, read, extract, stream or modify .zip files, including writing a function or script that zips or unzips: unzip or extract an upload, read a .zip, stream a large entry, append to or delete from an existing zip, safely handle untrusted zips (Zip Slip, zip bombs), or when reaching for adm-zip, jszip, archiver, yauzl or unzipper. Covers ZipFile, ZipBuffer, ZipEntry, zipFiles, createZipArchive, setMaxZipContentSize and zlib.crc32c. Node.js 26.8+ (not on v24).

Use this Skill: https://skilld.dev/gh/jasnell/node-skills/node-zip

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

rulesversions.md

≈455 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Version differences and portable detection

Availability

  • The ZIP API (ZipFile, ZipBuffer, ZipEntry, zipFiles, createZipArchive[Sync], get/setMaxZipContentSize) exists from v26.8.0 only. It is not in v25.x or v24.x (checked on v24.19.0, where every export is undefined). On v24, keep using an npm package, or gate the code:

    import * as zlib from 'node:zlib';
    if (typeof zlib.ZipFile !== 'function') throw new Error('Node.js >= 26.8 required for node:zlib ZIP');
  • The first use prints ExperimentalWarning: The zlib ZIP archive API is an experimental feature. Importing node:zlib alone does not.

zipEntry.rawContent: a getter on v26.x, a method on v27+

Version Shape File-backed / streaming entries
v26.8.0 to v26.13.x (checked on v26.13.0) a getter returning Buffer | null, the retained stored bytes null
v27.0.0-alpha.0.0.0+ and main the methods rawContent([{ maxSize }]) (a Promise), rawContentSync() and rawContentIterator() work for every readable entry

Detect the shape on an instance. Reading the v26 getter through ZipEntry.prototype throws a TypeError:

async function rawBytes(entry) {
  return typeof entry.rawContent === 'function' ? entry.rawContent() : entry.rawContent;
}

The docs (as of ab476eccd03) list rawContent([options]) as added: v26.8.0 and have no changes: entry for the switch from getter to method.

zlib.crc32c

Added in v27.0.0-alpha.0.0.0. It is absent on v26.13.0. Feature-detect it with typeof zlib.crc32c === 'function'.

Related, but documented elsewhere

The iterable compression transforms (compressGzip, decompressZstd, ...) live in node:zlib/iter, behind --experimental-stream-iter. See the node-stream-iter skill.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning5d3 checks · Risk SAFE
  • Gen Agent Trust Hub5d

    This skill provides comprehensive documentation and examples for the built-in ZIP archive support in Node.js (node:zlib). It includes dedicated security guidelines and safe coding patterns to protect against common ZIP-related vulnerabilities like path traversal (Zip Slip) and resource exhaustion (Zip bombs).

  • Socket5d

    No alerts

  • Snyk5d

    Risk: MEDIUM · 1 issue

Signed by skilld at 5f83e6c. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 5 days ago.

Activeupdated last week

README badge

README badge for jasnell/node-skills/node-zip