Get started with pako CDN
MIT licensed
Pako is a lightweight library for compressing and decompressing data using gzip and deflate algorithms.
Tags:- zlib
- deflate
- inflate
- gzip
Stable version
Copied!
How to start using pako CDN
// Include the pako library using the CDN link
const pako = await fetch('https://cdn.cdnhub.io/pako/2.1.0/pako.min.js').then(res => res.text()).then(text => new Function('return ' + text)());
// Compressing data using gzip compression
const dataToCompress = new TextEncoder().encode("This is some data to compress.");
const compressedData = pako.gzip(dataToCompress, { level: 9 });
// Decompressing data using gzip decompression
const decompressedData = pako.inflate(compressedData, { toConcat: true });
// Print the original data, compressed data, and decompressed data
console.log("Original data:", new TextDecoder().decode(dataToCompress));
console.log("Compressed data (base64):", btoa(String.fromCharCode.apply(null, new Uint8Array(compressedData.buffer))));
console.log("Decompressed data:", new TextDecoder().decode(decompressedData));
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!