-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1875340 - use JavaScript's DecompressionStream instead of 'pako' …
…package
- Loading branch information
1 parent
efbe618
commit 9b2adc9
Showing
4 changed files
with
9 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { inflate } from 'pako'; | ||
|
||
export const unGzip = async (binData) => { | ||
const decompressed = await inflate(binData, { to: 'string' }); | ||
return JSON.parse(decompressed); | ||
}; | ||
|
||
export default unGzip; | ||
export default async function unGzip(blob) { | ||
const decompressionStream = new DecompressionStream('gzip'); | ||
const decompressedStream = blob.stream().pipeThrough(decompressionStream); | ||
const payloadText = await ( | ||
await new Response(decompressedStream).blob() | ||
).text(); | ||
return JSON.parse(payloadText); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters