Summary
Most of Perry's node:zlib surface has been filled in, but the Node 22+ Zstd APIs are currently only exposed as shapes. The ZstdCompress / ZstdDecompress classes and createZstd* factory names exist for typeof checks, but there is no runtime codec implementation or native-table dispatch for Zstd compression/decompression.
Node Behavior
Modern Node exposes Zstd one-shot and stream APIs alongside the existing gzip/deflate/Brotli families:
const zlib = require("node:zlib");
const input = Buffer.from("perry zstd roundtrip");
console.log(typeof zlib.ZstdCompress);
console.log(typeof zlib.ZstdDecompress);
console.log(typeof zlib.createZstdCompress);
console.log(typeof zlib.createZstdDecompress);
console.log(typeof zlib.zstdCompressSync);
console.log(typeof zlib.zstdDecompressSync);
const compressed = zlib.zstdCompressSync(input);
console.log(zlib.zstdDecompressSync(compressed).toString());
Callback forms and Transform factories should follow the same Node zlib family semantics for the covered round-trip cases.
Perry Behavior
test-files/test_parity_zlib.ts probes zlib.ZstdCompress, zlib.ZstdDecompress, createZstdCompress, createZstdDecompress, zstdCompressSync, zstdDecompressSync, zstdCompress, and zstdDecompress.
crates/perry-api-manifest/src/entries.rs registers class("zlib", "ZstdCompress"), class("zlib", "ZstdDecompress"), zlib_stream_factory("createZstdCompress"), and zlib_stream_factory("createZstdDecompress"), but there are no zstdCompress, zstdDecompress, zstdCompressSync, or zstdDecompressSync manifest entries.
crates/perry-runtime/src/object/native_module.rs lists ZstdCompress, ZstdDecompress, createZstdCompress, and createZstdDecompress in the callable export whitelist, which makes property reads look function-shaped.
crates/perry-codegen/src/lower_call/native_table/media.rs has runtime rows for gzip/gunzip/deflate/inflate/raw/unzip and Brotli factories, but no createZstdCompress or createZstdDecompress rows.
crates/perry-stdlib/src/zlib.rs has stream codecs for gzip/gunzip/deflate/inflate/raw/unzip/Brotli, but no Codec::Zstd*, no js_zlib_create_zstd_*, and no one-shot Zstd functions.
Suggested PR Cut
Batch this with related issues in:
node:zlib: Zstd codec parity cut
Good batch candidates:
- none currently filed; this issue is the Zstd cut seed
Do not batch with:
Acceptance
- parity/regression test proves Zstd sync one-shot compression/decompression round-trips deterministic input
- callback-form Zstd APIs and
util.promisify() behavior match Node for covered cases, or are explicitly staged with follow-up leaves if not included in the first Zstd PR
createZstdCompress() / createZstdDecompress() are real Transform-compatible handles for covered round-trip cases
ZstdCompress / ZstdDecompress constructors match the surrounding zlib class export behavior for covered cases
- related known-failure/docs/manifest entries updated if touched
Summary
Most of Perry's
node:zlibsurface has been filled in, but the Node 22+ Zstd APIs are currently only exposed as shapes. TheZstdCompress/ZstdDecompressclasses andcreateZstd*factory names exist fortypeofchecks, but there is no runtime codec implementation or native-table dispatch for Zstd compression/decompression.Node Behavior
Modern Node exposes Zstd one-shot and stream APIs alongside the existing gzip/deflate/Brotli families:
Callback forms and Transform factories should follow the same Node zlib family semantics for the covered round-trip cases.
Perry Behavior
test-files/test_parity_zlib.tsprobeszlib.ZstdCompress,zlib.ZstdDecompress,createZstdCompress,createZstdDecompress,zstdCompressSync,zstdDecompressSync,zstdCompress, andzstdDecompress.crates/perry-api-manifest/src/entries.rsregistersclass("zlib", "ZstdCompress"),class("zlib", "ZstdDecompress"),zlib_stream_factory("createZstdCompress"), andzlib_stream_factory("createZstdDecompress"), but there are nozstdCompress,zstdDecompress,zstdCompressSync, orzstdDecompressSyncmanifest entries.crates/perry-runtime/src/object/native_module.rslistsZstdCompress,ZstdDecompress,createZstdCompress, andcreateZstdDecompressin the callable export whitelist, which makes property reads look function-shaped.crates/perry-codegen/src/lower_call/native_table/media.rshas runtime rows for gzip/gunzip/deflate/inflate/raw/unzip and Brotli factories, but nocreateZstdCompressorcreateZstdDecompressrows.crates/perry-stdlib/src/zlib.rshas stream codecs for gzip/gunzip/deflate/inflate/raw/unzip/Brotli, but noCodec::Zstd*, nojs_zlib_create_zstd_*, and no one-shot Zstd functions.Suggested PR Cut
Batch this with related issues in:
node:zlib: Zstd codec parity cutGood batch candidates:
Do not batch with:
zlib.codesmetadata in node:zlib: expose codes error-code table #2688Acceptance
util.promisify()behavior match Node for covered cases, or are explicitly staged with follow-up leaves if not included in the first Zstd PRcreateZstdCompress()/createZstdDecompress()are real Transform-compatible handles for covered round-trip casesZstdCompress/ZstdDecompressconstructors match the surrounding zlib class export behavior for covered cases