MCPcopy Create free account
hub / github.com/arfct/itty-bitty / compressDataGzip

Function compressDataGzip

docs/bitty.js:266–277  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

264}
265
266async function compressDataGzip(data) {
267 if (typeof CompressionStream !== 'undefined') {
268 let blob = new Blob([data])
269 const stream = blob.stream().pipeThrough(new CompressionStream("deflate"));
270 let response = await new Response (stream).arrayBuffer().catch(e => {console.error("CompressionStream error", e)})
271 if (response) return response
272 }
273
274 return import("/js/gzip/pako.min.js").then((module) => {
275 return pako.deflate(data, {level:"9"});
276 });
277}
278
279async function decompressData(data, encoding, callback) {
280 if (encoding == GZIP_MARKER) {

Callers 1

compressDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected