Repository navigation
Conversation
Node.js v26.8.0 (2026-08-26) added a ZIP archive API to `node:zlib`:
* `zlib.ZipBuffer`
* `zlib.ZipEntry`
* `zlib.ZipFile`
* `zlib.createZipArchive()`
* `zlib.createZipArchiveSync()`
* `zlib.zipFiles()`
* `zlib.getMaxZipContentSize()`
* `zlib.setMaxZipContentSize()`
This API allows developers to work with ZIP archives without having
to install third-party packages. Even though the API is marked as
"1.0 - Early development", developers want to experiment with this
functionality - myself included.
The implementation is still under active development. Therefore typing
adheres to documentation and not source code, except for where the docs
are silent and additional insights are needed (callback parameters for
`forEach()`/`forEachSync()` where docs just state `{Function}`). Using
documentation as the primary source also allows us to follow a simple
rule-based approach: when the docs change, the types change.
In turn we must accept that in some situations, typing will be stricter
than the underlying source code may currently permit. For example:
* `zipFiles()` accepts an async iterable at runtime, even though docs
only list a sync `Iterable`;
* `ZipFile` works with `await using` / `using` at runtime, due to an
undocumented `Symbol.asyncDispose` / `Symbol.dispose`;
* `ZipFile` is iterable at runtime with differing behavior between
sync (`[name, Promise<ZipEntry>]` pair) and async (plain resolved
`ZipEntry`) iterators, which the docs don't mention.
To clearly denote that the API behavior may change, the new classes and
functions all carry an `@experimental` tag.
Precedent for typing early-development APIs already exists:
* `node:test` `mock.module()` has the Stability 1.0 designation;
* `node:test` Test tags carry the Stability 1.0 designation;
* `node:quic` module as a whole has the Stability 1.0 designation.
Other v26.7/v26.8 changes are not included, as the scope of the change
is only adding the ZIP archive API. As a result, the overall package
version is not bumped.
|
@sigv Thank you for submitting this PR! This is a live comment that I will keep updated. 1 package in this PRCode ReviewsBecause this is a widely-used package, a DT maintainer will need to review it before it can be merged. You can test the changes of this PR in the Playground. Status
Once every item on this list is checked, I'll ask you for permission to merge and publish the changes. Diagnostic Information: What the bot saw about this PR{
"type": "info",
"now": "-",
"pr_number": 75745,
"author": "sigv",
"headCommitOid": "2bd2d0deb50156888551daa6b0292951508deaaa",
"mergeBaseOid": "73df926871e11d055f6a97d583eb17e220a8c819",
"lastPushDate": "2026-10-07T14:46:27.000Z",
"lastActivityDate": "2026-10-07T15:30:37.000Z",
"hasMergeConflict": false,
"isFirstContribution": false,
"tooManyFiles": false,
"hugeChange": false,
"tooManyCommits": false,
"tooManyReviews": false,
"popularityLevel": "Critical",
"pkgInfo": [
{
"name": "node",
"version": "26.6",
"kind": "edit",
"files": [
{
"path": "types/node/node-tests/zlib.ts",
"kind": "test"
},
{
"path": "types/node/zlib.d.ts",
"kind": "definition"
}
],
"owners": [
"Microsoft",
"jkomyno",
"r3nya",
"btoueg",
"touffy",
"mohsen1",
"galkin",
"eps1lon",
"WilcoBakker",
"trivikr",
"yoursunny",
"ExE-Boss",
"peterblazejewicz",
"addaleax",
"NodeJS",
"LinusU",
"wafuwafu13",
"mcollina",
"Semigradsky",
"Renegade334",
"anonrig"
],
"addedOwners": [],
"deletedOwners": [],
"popularityLevel": "Critical"
}
],
"reviews": [],
"mainBotCommentID": 6040469599,
"ciResult": "pass"
} |
|
🔔 @microsoft @jkomyno @r3nya @btoueg @Touffy @mohsen1 @galkin @eps1lon @WilcoBakker @trivikr @yoursunny @ExE-Boss @peterblazejewicz @addaleax @nodejs @LinusU @wafuwafu13 @mcollina @Semigradsky @Renegade334 @anonrig — please review this PR in the next few days. Be sure to explicitly select |
|
In-line documentation is pulled from upstream docs/api/zlib.md. |
Node.js v26.8.0 (2026-08-26) added a ZIP archive API to
node:zlib:zlib.ZipBufferzlib.ZipEntryzlib.ZipFilezlib.createZipArchive()zlib.createZipArchiveSync()zlib.zipFiles()zlib.getMaxZipContentSize()zlib.setMaxZipContentSize()This API allows developers to work with ZIP archives without having to install third-party packages. Even though the API is marked as "1.0 - Early development", developers want to experiment with this functionality - myself included.
The implementation is still under active development. Therefore typing adheres to documentation and not source code, except for where the docs are silent and additional insights are needed (callback parameters for
forEach()/forEachSync()where docs just state{Function}). Using documentation as the primary source also allows us to follow a simple rule-based approach: when the docs change, the types change.In turn we must accept that in some situations, typing will be stricter than the underlying source code may currently permit. For example:
zipFiles()accepts an async iterable at runtime, even though docs only list a syncIterable;ZipFileworks withawait using/usingat runtime, due to an undocumentedSymbol.asyncDispose/Symbol.dispose;ZipFileis iterable at runtime with differing behavior between sync ([name, Promise<ZipEntry>]pair) and async (plain resolvedZipEntry) iterators, which the docs don't mention.To clearly denote that the API behavior may change, the new classes and functions all carry an
@experimentaltag.Precedent for typing early-development APIs already exists:
node:testmock.module()has the Stability 1.0 designation;node:testTest tags carry the Stability 1.0 designation;node:quicmodule as a whole has the Stability 1.0 designation.Other v26.7/v26.8 changes are not included, as the scope of the change is only adding the ZIP archive API. As a result, the overall package version is not bumped.
pnpm test <package to test>.If changing an existing definition:
package.jsonis therefore not updated.