Skip to content

vishwajeet-pandey-exa/string-compression-utils

 
 

Repository files navigation

String Compression

Compress or decompress a string with native browser APIs with gzip, deflate, or deflate-raw.
Compatible to use with atob and btoa.

Example Usage

import { compress, decompress } from '@zalari/string-compression-utils';

const input = '{"id":1,"todo":"Do something nice for someone you care about","completed":true,"userId":26}';

const compressedString = await compress(input, 'gzip');
const urlFriendly = encodeURIComponent(compressedString);

const decodedString = decodeURIComponent(urlFriendly);
const output = await decompress(decodedString, 'gzip');

console.assert(input === output);

About

Compress or decompress a string with native browser APIs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • TypeScript 69.5%
  • JavaScript 30.5%