* @param {'deflate'|'deflate-raw'|'gzip'|'brotli'} format
(format)
| 125 | * @param {'deflate'|'deflate-raw'|'gzip'|'brotli'} format |
| 126 | */ |
| 127 | constructor(format) { |
| 128 | format = formatConverter(format, { |
| 129 | prefix: "Failed to construct 'DecompressionStream'", |
| 130 | context: '1st argument', |
| 131 | }); |
| 132 | switch (format) { |
| 133 | case 'deflate': |
| 134 | this.#handle = lazyZlib().createInflate({ |
| 135 | rejectGarbageAfterEnd: true, |
| 136 | }); |
| 137 | break; |
| 138 | case 'deflate-raw': |
| 139 | this.#handle = lazyZlib().createInflateRaw({ |
| 140 | rejectGarbageAfterEnd: true, |
| 141 | }); |
| 142 | break; |
| 143 | case 'gzip': |
| 144 | this.#handle = lazyZlib().createGunzip({ |
| 145 | rejectGarbageAfterEnd: true, |
| 146 | }); |
| 147 | break; |
| 148 | case 'brotli': |
| 149 | this.#handle = lazyZlib().createBrotliDecompress({ |
| 150 | rejectGarbageAfterEnd: true, |
| 151 | }); |
| 152 | break; |
| 153 | } |
| 154 | this.#transform = newReadableWritablePairFromDuplex(this.#handle, { |
| 155 | [kValidateChunk]: validateBufferSourceChunk, |
| 156 | [kDestroyOnSyncError]: true, |
| 157 | }); |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | * @readonly |
nothing calls this directly
no test coverage detected