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

@squoosh-kit/core

v0.2.4

Published

Per-feature adapters around Squoosh codecs, worker/client runtimes.

Readme

@squoosh-kit/core

npm version Bun License: MIT License: Apache 2.0 TypeScript

Squoosh-Kit

Squoosh-Kit

Squoosh-Kit is built on a simple idea: provide a lightweight and modular bridge to the powerful, production-tested codecs from Google's Squoosh project.

Directly from the Source We don't modify the core codecs. The WebAssembly (.wasm) binaries are taken directly from the official Squoosh repository builds. This means you get the exact same performance, quality, and reliability you'd expect from Squoosh.

A Thin, Modern Wrapper Our goal is to provide a minimal, modern JavaScript wrapper around these codecs. We handle the tricky parts—like loading WASM, managing web workers, and providing a clean, type-safe API—so you can focus on your application. The library is designed to be a thin bridge, not a heavy framework.

Modular by Design While this core package bundles everything for convenience, the Squoosh-Kit philosophy is to provide small, focused packages so you only install what you need. See the Individual Packages section to use a specific codec directly.

Installation

bun add @squoosh-kit/core
# or
npm install @squoosh-kit/core

Quick Start

All codecs are namespaced to avoid collisions — multiple packages export encode and decode, so they live under their own namespace:

import { webp, avif, mozjpeg, resize, png, rotate } from '@squoosh-kit/core';
import type { ImageInput } from '@squoosh-kit/core';

const imageData: ImageInput = {
  data: rawPixelBuffer,
  width: 1920,
  height: 1080,
};

// Encode to WebP
const webpBuffer = await webp.encode(imageData, { quality: 85 });

// Encode to AVIF
const avifBuffer = await avif.encode(imageData, { quality: 60 });

// Resize first, then encode
const resized = await resize.resize(imageData, { width: 800, height: 600 });
const thumbnail = await mozjpeg.encode(resized, { quality: 80 });

// Lossless PNG
const pngBuffer = await png.encode(imageData);

// Rotate 90 degrees
const rotated = await rotate.rotate(imageData, { rotate: 90 });

What's Included

This package bundles all Squoosh-Kit codecs under a single import:

| Namespace | Package | Purpose | | ------------ | ------------------------- | ------------------------------------ | | webp | @squoosh-kit/webp | WebP encoding/decoding | | avif | @squoosh-kit/avif | AVIF encoding/decoding | | mozjpeg | @squoosh-kit/mozjpeg | Optimized JPEG encoding/decoding | | jxl | @squoosh-kit/jxl | JPEG XL encoding/decoding | | wp2 | @squoosh-kit/wp2 | WP2 encoding/decoding (experimental) | | png | @squoosh-kit/png | Lossless PNG encoding/decoding | | qoi | @squoosh-kit/qoi | QOI lossless encoding/decoding | | resize | @squoosh-kit/resize | High-quality image resizing | | rotate | @squoosh-kit/rotate | 90°/180°/270° rotation | | oxipng | @squoosh-kit/oxipng | Lossless PNG optimization | | imagequant | @squoosh-kit/imagequant | Palette quantization (PNG-8) | | hqx | @squoosh-kit/hqx | Pixel-art upscaling (2x/3x/4x) | | visdif | @squoosh-kit/visdif | Butteraugli perceptual comparison |

When to Use Core vs Individual Packages

Use @squoosh-kit/core when:

  • You need multiple codecs and want a single import
  • You're exploring the library and want everything available
  • Bundle size is not a concern (e.g., server-side tooling)

Use individual packages when:

  • You only need one specific codec
  • Bundle size is critical (install only @squoosh-kit/webp, @squoosh-kit/avif, etc.)
  • You need fine-grained control over versions

Individual Packages

Each codec is available as a standalone package on npm:

| Package | npm | | -------------------------- | --------------------------------------------------------------------------------------------------------------------------- | | @squoosh-kit/webp | npm | | @squoosh-kit/avif | npm | | @squoosh-kit/mozjpeg | npm | | @squoosh-kit/jxl | npm | | @squoosh-kit/wp2 | npm | | @squoosh-kit/png | npm | | @squoosh-kit/qoi | npm | | @squoosh-kit/resize | npm | | @squoosh-kit/rotate | npm | | @squoosh-kit/oxipng | npm | | @squoosh-kit/imagequant | npm | | @squoosh-kit/hqx | npm | | @squoosh-kit/visdif | npm | | @squoosh-kit/runtime | npm | | @squoosh-kit/vite-plugin | npm |

API Reference

All functions follow the same patterns as the individual packages. For detailed documentation including options, examples, and edge cases, see the individual package READMEs:

  • WebPencode, decode, createWebpEncoder, createWebpDecoder
  • AVIFencode, decode, createAvifEncoder, createAvifDecoder, AVIFTune
  • MozJPEGencode, decode, createMozjpegEncoder, createMozjpegDecoder
  • JPEG XLencode, decode, createJxlEncoder, createJxlDecoder
  • WP2encode, decode, createWp2Encoder, createWp2Decoder, UVMode, Csp
  • PNGencode, decode, createPngEncoder, createPngDecoder
  • QOIencode, decode, createQoiEncoder, createQoiDecoder
  • Resizeresize, createResizer
  • Rotaterotate, createRotator
  • OxiPNGoptimize, createOxipngOptimizer
  • ImageQuantquantize, createImagequantQuantizer
  • HQXupscale, createHqxUpscaler
  • VisDifcompare, createVisDiff

License

MIT - part of the Squoosh-Kit family