npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@shgysk8zer0/squish

v1.0.2

Published

Tiny JS compression/decompression library using `CompressionStream`s

Downloads

143

Readme

@shgysk8zer0/squish

Tiny JS compression/decompression library using CompressionStream

CodeQL Node CI Lint Code Base

GitHub license GitHub last commit GitHub release GitHub Sponsors

npm node-current npm bundle size gzipped npm

GitHub followers GitHub forks GitHub stars Twitter Follow

Donate using Liberapay


Efficient Data Compression and Decompression

Squish is a tiny JavaScript library that provides functionalities for efficient data compression and decompression. It supports various input and output formats, making it a versatile tool for optimizing data transmission and storage.

Features

  • Highly Compressed: The library itself is minified and compressed to an exceptionally small size, minimizing its footprint in your project.
  • Versatile Input: Accepts a wide range of input data types, including ReadableStream, ArrayBuffer, Uint8Array, Blob, Response, Request, and even strings.
  • Compression Algorithms: Supports both gzip and deflate compression algorithms, providing flexibility for different use cases.
  • Decompression: Decompresses data compressed with gzip and deflate algorithms.
  • Rich Output Formats: Offers a variety of output formats, including blob, stream, response, buffer, bytes, hex, base64, base64url, url, and text.

Installation

You can install the library using npm or by importing from a CDN such as unpkg.com:

npm install `@shgysk8zer0/squish`

or with a <script type="importmap">

<script type="importmap">
  {
    "imports": {
      "@shgysk8zer0/squish": "https://unpkg.com/@shgysk8zer0/[email protected]/squish.min.js"
    }
  }
</script>

Usage

The library provides several functions for compression and decompression:

  • compress(data, options): Compresses the given data using the specified options.
  • decompress(data, options): Decompresses the given data using the specified options.
  • gzip(data, options): Compresses the data using the gzip algorithm.
  • gunzip(data, options): Decompresses the data compressed with gzip.
  • deflate(data, options): Compresses the data using the deflate algorithm.
  • inflate(data, options): Decompresses the data compressed with deflate.

Usage Example

Basic usage

import { gzip, gunzip } from '@shgysk8zer0/squish';

const compressed = await gzip('Hello, World!');
const decompressed = await gunzip(compressed, { output: 'text' });

Node usage (CJS - ESM also supported)

const { inflate } = require('@shgysk8zer0/squish');
const { readFile } = require('node:js');

async function sendFile(file) {
  const buffer = readFile(file);
  const compressed = await inflate(buffer);
  
  return new Response(compressed);
}

Requirements

This library requires many new features that are not yet wideley supported. A polyfill is provided in node, but you may want to proved your own for certain usages in browsers.