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

qrush-compressor

v0.0.2-20260205-2

Published

Fast file and image compression library using WebAssembly. Perfect for Angular, React, Vue, and other web frameworks.

Readme

🦀 Qrush Compressor

Fast file and image compression library powered by WebAssembly (Rust).

Installation

npm install qrush-compressor

Quick Start

Initialize WASM

import initCompressor from 'qrush-compressor';
await initCompressor();  // Required before using any function

Compress Data

import { compress, WasmCompressionMethod, WasmCompressionLevel } from 'qrush-compressor';

const data = new Uint8Array([...]);
const result = compress(data, WasmCompressionMethod.Gzip, WasmCompressionLevel.Best);

console.log(`Original: ${result.original_size()} bytes`);
console.log(`Compressed: ${result.compressed_size()} bytes`);
console.log(`Ratio: ${(result.compression_ratio() * 100).toFixed(2)}%`);

Compress Image

import { compress_image_jpeg } from 'qrush-compressor';

const imageData = new Uint8Array([...]); // Your image file
const result = compress_image_jpeg(imageData, 85); // Quality 1-100
const jpegBytes = result.data();

Resize & Compress Image

import { compress_and_resize_image } from 'qrush-compressor';

const result = compress_and_resize_image(
  imageData,
  1920,  // max width (null for auto)
  null,  // max height (null for auto)
  85     // quality
);

Framework Examples

React

import { useEffect, useState } from 'react';
import initCompressor, { compress_image_jpeg } from 'qrush-compressor';

function App() {
  const [ready, setReady] = useState(false);

  useEffect(() => {
    initCompressor().then(() => setReady(true));
  }, []);

  const handleFile = async (e: React.ChangeEvent<HTMLInputElement>) => {
    if (!ready || !e.target.files) return;
    const file = e.target.files[0];
    const data = new Uint8Array(await file.arrayBuffer());
    const result = compress_image_jpeg(data, 85);
    console.log(`Saved ${((1 - result.compression_ratio()) * 100).toFixed(2)}%`);
  };

  return <input type="file" onChange={handleFile} accept="image/*" />;
}

Angular

import { Component, OnInit } from '@angular/core';
import initCompressor, { compress, WasmCompressionMethod } from 'qrush-compressor';

@Component({
  selector: 'app-root',
  template: '<input type="file" (change)="onFile($event)">'
})
export class AppComponent implements OnInit {
  async ngOnInit() {
    await initCompressor();
  }

  async onFile(event: any) {
    const file = event.target.files[0];
    const data = new Uint8Array(await file.arrayBuffer());
    const result = compress(data, WasmCompressionMethod.Brotli);
    console.log(`Compressed to ${result.compressed_size()} bytes`);
  }
}

Vue 3

<script setup lang="ts">
import { ref, onMounted } from 'vue';
import initCompressor, { compress_image_jpeg } from 'qrush-compressor';

onMounted(async () => {
  await initCompressor();
});

async function handleFile(e: Event) {
  const file = (e.target as HTMLInputElement).files?.[0];
  if (!file) return;
  const data = new Uint8Array(await file.arrayBuffer());
  const result = compress_image_jpeg(data, 80);
  console.log(`Compressed: ${result.compressed_size()} bytes`);
}
</script>

<template>
  <input type="file" @change="handleFile" accept="image/*">
</template>

API Reference

Compression Methods

  • WasmCompressionMethod.Gzip - Standard GZIP
  • WasmCompressionMethod.Zlib - ZLIB format
  • WasmCompressionMethod.Brotli - Best compression

Compression Levels

  • WasmCompressionLevel.Fast - Fastest
  • WasmCompressionLevel.Default - Balanced
  • WasmCompressionLevel.Best - Maximum compression

Functions

compress(data, method, level)

Compress binary data.

decompress(data, method)

Decompress previously compressed data.

compress_image_jpeg(data, quality)

Compress image to JPEG format.

compress_and_resize_image(data, maxWidth, maxHeight, quality)

Resize and compress image in one step.

Performance

| Method | Compression | Speed | |--------|-------------|-------| | Brotli | Best (~20%) | Slow | | ZLIB | Good (~25%) | Fast | | GZIP | Good (~26%) | Fast |

Browser Support

All modern browsers (Chrome, Firefox, Safari, Edge).

License

MIT