* @param {'deflate'|'deflate-raw'|'gzip'|'brotli'} format
(format)
| 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 |
nothing calls this directly
no test coverage detected