MCPcopy
hub / github.com/nodejs/undici / _transform

Method _transform

lib/web/fetch/util.js:1249–1265  ·  view source on GitHub ↗
(chunk, encoding, callback)

Source from the content-addressed store, hash-verified

1247 }
1248
1249 _transform (chunk, encoding, callback) {
1250 if (!this._inflateStream) {
1251 if (chunk.length === 0) {
1252 callback()
1253 return
1254 }
1255 this._inflateStream = (chunk[0] & 0x0F) === 0x08
1256 ? zlib.createInflate(this.#zlibOptions)
1257 : zlib.createInflateRaw(this.#zlibOptions)
1258
1259 this._inflateStream.on('data', this.push.bind(this))
1260 this._inflateStream.on('end', () => this.push(null))
1261 this._inflateStream.on('error', (err) => this.destroy(err))
1262 }
1263
1264 this._inflateStream.write(chunk, encoding, callback)
1265 }
1266
1267 _final (callback) {
1268 if (this._inflateStream) {

Callers

nothing calls this directly

Calls 4

onMethod · 0.45
pushMethod · 0.45
destroyMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected