workerd icon indicating copy to clipboard operation
workerd copied to clipboard

Missing `{ info: true }` support on `node:zlib`

Open anonrig opened this issue 1 year ago • 0 comments

We currently roll our own implementation for convenience methods that doesn't support {info:true} options.

Node.js implementation which lives under https://github.com/nodejs/node/blob/main/lib/zlib.js#L160 is as follows:

function zlibBufferOnEnd() {
  let buf;
  if (this.nread === 0) {
    buf = Buffer.alloc(0);
  } else {
    const bufs = this.buffers;
    buf = (bufs.length === 1 ? bufs[0] : Buffer.concat(bufs, this.nread));
  }
  this.close();
  if (this._info)
    this.cb(null, { buffer: buf, engine: this });
  else
    this.cb(null, buf);
}

We need to support this.info check for existing TODO tests to succeed.

anonrig avatar Sep 03 '24 20:09 anonrig