MCPcopy Create free account
hub / github.com/nodejs/node / constructor

Method constructor

lib/internal/webstreams/compression.js:71–94  ·  view source on GitHub ↗

* @param {'deflate'|'deflate-raw'|'gzip'|'brotli'} format

(format)

Source from the content-addressed store, hash-verified

69 * @param {'deflate'|'deflate-raw'|'gzip'|'brotli'} format
70 */
71 constructor(format) {
72 format = formatConverter(format, {
73 prefix: "Failed to construct 'CompressionStream'",
74 context: '1st argument',
75 });
76 switch (format) {
77 case 'deflate':
78 this.#handle = lazyZlib().createDeflate();
79 break;
80 case 'deflate-raw':
81 this.#handle = lazyZlib().createDeflateRaw();
82 break;
83 case 'gzip':
84 this.#handle = lazyZlib().createGzip();
85 break;
86 case 'brotli':
87 this.#handle = lazyZlib().createBrotliCompress();
88 break;
89 }
90 this.#transform = newReadableWritablePairFromDuplex(this.#handle, {
91 [kValidateChunk]: validateBufferSourceChunk,
92 [kDestroyOnSyncError]: true,
93 });
94 }
95
96 /**
97 * @readonly

Callers

nothing calls this directly

Calls 2

lazyZlibFunction · 0.85

Tested by

no test coverage detected