Socket
Socket
Sign inDemoInstall

@zalari/string-compression-utils

Package Overview
Dependencies
0
Maintainers
3
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @zalari/string-compression-utils

Compress or decompress a string with native browser APIs.


Version published
Maintainers
3
Created

Readme

Source

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);

Keywords

FAQs

Last updated on 01 Aug 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc