Skip to content

Commit

Permalink
chore: correctly use deflate
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny committed Dec 5, 2024
1 parent 17f7bcd commit d415432
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/util/inflate.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
export async function inflate(zlibCompressedData) {
// Strip the zlib header and footer
const strippedData = zlibCompressedData.subarray(2, -4); // Remove 2-byte header and 4-byte Adler-32 footer

const inputStream = new ReadableStream({
start(controller) {
controller.enqueue(strippedData);
controller.enqueue(zlibCompressedData);
controller.close();
},
});

const decompressedStream = inputStream.pipeThrough(
new DecompressionStream('deflate-raw'),
new DecompressionStream('deflate'),
);

const reader = decompressedStream.getReader();
Expand Down

0 comments on commit d415432

Please sign in to comment.