MCPcopy
hub / github.com/socketio/socket.io / compress

Method compress

packages/engine.io/lib/transports-uws/polling.ts:364–380  ·  view source on GitHub ↗

* Compresses data. * * @private

(data, encoding, callback)

Source from the content-addressed store, hash-verified

362 * @private
363 */
364 compress(data, encoding, callback) {
365 debug("compressing");
366
367 const buffers = [];
368 let nread = 0;
369
370 compressionMethods[encoding](this.httpCompression)
371 .on("error", callback)
372 .on("data", function (chunk) {
373 buffers.push(chunk);
374 nread += chunk.length;
375 })
376 .on("end", function () {
377 callback(null, Buffer.concat(buffers, nread));
378 })
379 .end(data);
380 }
381
382 /**
383 * Closes the transport.

Callers 1

doWriteMethod · 0.95

Calls 4

debugFunction · 0.85
callbackFunction · 0.50
endMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected