Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
: function inflate(value : Uint8Array) {
return new Binary(pako.inflate(new Uint8Array(value)));
};
function dupe(type : Type, value : Body) {
if (type === "blob") {
if (type.length >= 100) return value;
return new Binary(value as Uint8Array);
}
return decoders[type]((encoders[type] as any)(value as any) as any);
}
export default function inflateStream() {
let inf = new Inflate();
const b = new Uint8Array(1);
const empty = new Binary(0);
return {
write: write,
recycle: recycle,
flush: Binary === Uint8Array ? flush : flushConvert
};
function write(byte : number) {
b[0] = byte;
inf.push(b);
return !(inf as any).ended;
}
function recycle() { inf = new Inflate(); }
function flush() { return inf.result as Uint8Array || empty; }
: function deflate(value : Uint8Array) {
return new Binary(pako.deflate(new Uint8Array(value)));
};
function flushConvert() {
return inf.result ? new Binary((inf as any).result) : empty;
}
};