diff options
| author | Divy Srivastava <dj.srivastava23@gmail.com> | 2024-03-12 17:23:31 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-12 17:23:31 +0530 |
| commit | 4a88695563ced73e18a97be06f9f0864be683eff (patch) | |
| tree | 65837c501c755cf9f5339ce9d9e437a5a0d01724 /ext/node/polyfills | |
| parent | ad6b00a2bf061a90c72737d0ecc4a58bb0a89550 (diff) | |
fix(ext/node): flush brotli decompression stream (#22856)
Fixes https://github.com/denoland/deno/issues/22259
The decompressed input size was not restored because of improper
flushing of the CBrotliDecompressStream state.
Diffstat (limited to 'ext/node/polyfills')
| -rw-r--r-- | ext/node/polyfills/_brotli.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/node/polyfills/_brotli.js b/ext/node/polyfills/_brotli.js index b019836cf..8b1f53012 100644 --- a/ext/node/polyfills/_brotli.js +++ b/ext/node/polyfills/_brotli.js @@ -12,6 +12,7 @@ import { op_brotli_decompress, op_brotli_decompress_async, op_brotli_decompress_stream, + op_brotli_decompress_stream_end, op_create_brotli_compress, op_create_brotli_decompress, } from "ext:core/ops"; @@ -57,6 +58,11 @@ export class BrotliDecompress extends Transform { callback(); }, flush(callback) { + const output = new Uint8Array(1024); + let avail; + while ((avail = op_brotli_decompress_stream_end(context, output)) > 0) { + this.push(output.slice(0, avail)); + } core.close(context); callback(); }, |
