Skip to content

node:zlib: compression options and stream retuning parity cut #2557

Description

@andrewtdiz

Summary

Use this issue as the PR-cut tracker for Node-compatible zlib option objects and stream retuning. Perry exposes most non-Zstd node:zlib codec shapes, but one-shot codecs, stream factories, Brotli params, dictionaries/output limits, and stream.params() do not yet apply Node's option semantics consistently.

Child Issues

Intended PR Boundary

A good medium-sized PR should parse, validate, and apply the common Node zlib options for already implemented codecs:

  • one-shot zlib methods: level, strategy, windowBits, memLevel, dictionary, flush / finishFlush, and maxOutputLength where applicable;
  • Brotli one-shot and stream methods: params, chunkSize, maxOutputLength, info, and dictionary/decompressor options where applicable;
  • stream factories: carry parsed options into encoder/decoder state instead of using fixed defaults;
  • stream.params(level, strategy, callback): validate inputs, retune deflate-family streams, and complete the callback with Node-observable semantics.

Exact compressed bytes do not need to match Node when the backend produces a valid stream, but output must be option-sensitive and validation must match Node for covered cases.

Non-Goals

Evidence

  • docs/runtime-parity-gaps.md lists node:zlib options-adjacent APIs such as stream factories, one-shot raw/Brotli codecs, params(), bytesWritten, bytesRead, crc32, and constants as gaps.
  • test-parity/node-suite/zlib already has deterministic round-trip, constants, Brotli, raw, unzip, stream, and crc32 fixtures that can be extended for option-sensitive behavior.
  • Source evidence in the child issues points at one-shot codecs using fixed compression defaults, stream factories ignoring _opts, fixed Brotli quality/window settings, and zlib_stream_params() ignoring handle/level/strategy.
  • Duplicate searches for node:zlib zlib options level strategy windowBits memLevel dictionary Brotli params quality chunkSize and node:zlib stream.params params level strategy callback retune found this tracker and no active PR.

Acceptance

  • Child issues above have focused parity/regression coverage.
  • One-shot and stream-factory option objects produce Node-compatible validation and option-sensitive output for covered cases.
  • stream.params() retunes supported deflate-family streams or reports Node-compatible errors for covered cases.
  • Existing gzip/deflate/raw/Brotli round-trip fixtures keep passing.
  • Related parity docs / known-failure entries are updated if touched.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions