mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-27 06:43:19 +08:00
flush() on a zlib stream writes a zero-length chunk that _transform recognizes by identity and compresses with that flush kind. Since writes of a typed array that is not a Buffer reach _write as a Buffer over the same bytes (as Node's Stream._uint8ArrayToBuffer does), the sentinel, created as a plain Uint8Array, reached _transform as a new Buffer. _transform then used the default NO_FLUSH, so flush() emitted nothing: corpus 5374-zlib-stream-flush-params decoded an empty prefix where Node decodes "hello ". The sentinels are Buffers, as Node's kFlushBuffers are (Buffer.alloc(0)), so write() passes them through unchanged. The npm fixture stream-shims, whose test expected a deferred SC1090, now runs to a later deferred refusal, SC2020 (write completion callbacks taking the error argument); its expectation names that code.