( format?: CompressionFormat, )
| 171 | } |
| 172 | |
| 173 | export const createDecompressionStream = ( |
| 174 | format?: CompressionFormat, |
| 175 | ): Transform => { |
| 176 | if (!format) { |
| 177 | return new PassThrough() |
| 178 | } |
| 179 | |
| 180 | switch (format) { |
| 181 | case CompressionFormat.GZIP: |
| 182 | return createGunzip() |
| 183 | case CompressionFormat.XZ: |
| 184 | return getLzmaNative().createDecompressor() |
| 185 | default: |
| 186 | throw new Error(`Unsupported compression format: ${String(format)}`) |
| 187 | } |
| 188 | } |
no test coverage detected