MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / deflate

Function deflate

tests/modules/data/zlib/deflateinflate.js:65–79  ·  view source on GitHub ↗
(data, options)

Source from the content-addressed store, hash-verified

63}
64
65function deflate(data, options) {
66 const deflate = new Deflate(options);
67 const chunkSize = options.chunkSize;
68 if (undefined === chunkSize)
69 deflate.push(data, true);
70 else {
71 for (let offset = 0; offset < data.byteLength; offset += chunkSize) {
72 const use = Math.min(chunkSize, data.byteLength - offset);
73 const last = (offset + chunkSize) >= data.byteLength;
74 deflate.push(data.slice(offset, offset + use), last);
75 }
76 }
77 deflate.close();
78 return deflate.result;
79}
80
81function inflate(data, options) {
82 const inflate = new Inflate(options);

Callers 2

xs_deflate_pushFunction · 0.85
testInflateFunction · 0.85

Calls 3

pushMethod · 0.95
closeMethod · 0.95
sliceMethod · 0.65

Tested by

no test coverage detected