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

Function decompressData

docs/bitty.js:279–296  ·  view source on GitHub ↗
(data, encoding, callback)

Source from the content-addressed store, hash-verified

277}
278
279async function decompressData(data, encoding, callback) {
280 if (encoding == GZIP_MARKER) {
281 return decompressDataGzip(data)
282 } else if (encoding == BROT_MARKER) {
283 return import("/js/brotli/decode.js").then((module) => {
284 return module.BrotliDecode(data);
285 });
286 } else if (encoding == LZMA_MARKER || encoding == LZMA64_MARKER) {
287 return new Promise(function(resolve, reject) {
288 loadScript("/js/lzma/lzma_worker-min.js").then((s) => {
289 LZMA.decompress(data, (result, error) => {
290 if (error) reject(error);
291 resolve(stringToByteArray(result));
292 });
293 })
294 });
295 }
296}
297
298
299async function encryptData(cipher, pass, base64) {

Callers 1

DataURLClass · 0.85

Calls 3

decompressDataGzipFunction · 0.85
stringToByteArrayFunction · 0.85
loadScriptFunction · 0.70

Tested by

no test coverage detected