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

squeezjs

v1.0.0

Published

A lightweight image compression service that resizes and converts images to JPEG format.

Readme

🗜️ SqueezJS

Lightweight, instant image compression for the modern web.

SqueezJS is a zero-dependency JavaScript library that resizes and converts images to optimized JPEG format — right in the browser. No servers. No uploads. No bloat. Just squeeze.

License: MIT Node PRs Welcome


✨ Why SqueezJS?

  • Instant output — compression happens client-side with zero network round-trips
  • 🪶 Featherweight — no dependencies, no build step, just drop it in
  • 🖼️ Smart resizing — preserves aspect ratio and never upscales
  • 🎛️ Fully configurable — control quality and maximum dimensions
  • 🔒 Privacy-first — images never leave the user's device
  • 🌐 Works everywhere — any modern browser with Canvas support

📦 Installation

npm install squeezjs

Or grab the source directly and import it:

import FileCompressor from "./compressor";

🚀 Quick Start

import FileCompressor from "squeezjs";

// Create a compressor with default settings
const compressor = new FileCompressor();

// Compress an image file
const input = document.querySelector('input[type="file"]');

input.addEventListener("change", async (event) => {
  const file = event.target.files[0];
  const compressed = await compressor.compress(file);

  // Use the compressed File however you like
  const url = URL.createObjectURL(compressed);
  document.querySelector("img").src = url;
});

⚙️ Configuration

Customize the compressor by passing options to the constructor:

const compressor = new FileCompressor({
  quality: 0.8, // JPEG quality (0 to 1) — default: 0.7
  width: 1280, // Max output width in px — default: 1920
  height: 1280, // Max output height in px — default: 1920
});

| Option | Type | Default | Description | | --------- | ------ | ------- | --------------------------------- | | quality | number | 0.7 | JPEG compression quality (0 to 1) | | width | number | 1920 | Maximum output width in pixels | | height | number | 1920 | Maximum output height in pixels |

Note: Images smaller than the maximum dimensions are never upscaled — SqueezJS only shrinks.


🧠 API

new FileCompressor(options?)

Creates a new compressor instance.

| Parameter | Type | Description | | --------- | ------ | ---------------------------------- | | options | object | Optional configuration (see above) |

compress(file) → Promise<File>

Compresses an image file and returns a new JPEG File object.

| Parameter | Type | Description | | --------- | ------ | -------------------------- | | file | File | The image file to compress |

Returns: Promise<File> — a compressed JPEG file.


🧪 Example

import FileCompressor from "squeezjs";

const compressor = new FileCompressor({ quality: 0.6, width: 1024 });

const file = await compressor.compress(myImageFile);
console.log(`Original: ${myImageFile.size} bytes`);
console.log(`Compressed: ${file.size} bytes`);

🛠️ How It Works

  1. Load — the image is loaded into memory via an object URL
  2. Measure — dimensions are calculated to fit within your max bounds while preserving aspect ratio
  3. Draw — the image is redrawn onto an off-screen canvas at the new size
  4. Encode — the canvas is exported as a JPEG blob at your chosen quality
  5. Deliver — a fresh File object is returned, ready to upload or display

🤝 Contributing

Contributions, issues, and feature requests are welcome!

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing)
  5. Open a Pull Request

📄 License

Distributed under the MIT License. See LICENSE for more information.


Made with ❤️ by Mashrafi Mahin