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

mytinypng

v0.1.0

Published

TinyPNG-quality batch image compression — CLI and library (sharp + mozjpeg + libimagequant + oxipng).

Readme

mytinypng

TinyPNG-quality batch image compression — as a CLI and a library. Re-encodes JPEG with mozjpeg, PNG with libimagequant + oxipng, and WebP/AVIF with libvips. Validated head-to-head against the real TinyPNG API (equal perceptual quality, equal-or-smaller files).

CLI

npx mytinypng <files | globs | dirs...> [options]
npx mytinypng image.png                 # -> image.min.png (never overwrites by default)
npx mytinypng "src/**/*.{png,jpg}" -w    # overwrite matches in place
npx mytinypng photos/ -r -o dist/        # mirror photos/ into dist/, compressed
npx mytinypng hero.png --to webp         # convert format
npx mytinypng banner.png --smart         # per-image adaptive quality (SSIM target)
npx mytinypng assets/ -r -w --cache      # idempotent — skip already-compressed files

Options

| Option | Description | | ------ | ----------- | | -o, --output <dir> | Write into <dir>, mirroring the input's relative path | | -w, --overwrite | Overwrite the originals in place | | --suffix <s> | Suffix for the default (non-overwrite) mode — default .min | | -q, --quality <1-100> | Fixed quality (default: tuned per format) | | --smart / --ssim <0-1> | Smallest output keeping perceptual SSIM ≥ target (default 0.99) | | --lossless | No quality loss | | --skip-oxipng | Skip the lossless PNG post-pass (faster) | | --cache / --cache-file <p> | Skip files already compressed by us (content-hash manifest) | | --force | Re-process even if cached | | -f, --to <fmt> | Convert to jpeg | png | webp | avif | | -r, --recursive | Recurse into directories | | --concurrency <n> | Parallel files (default: CPU cores) | | --dry-run / --json / --quiet | Preview / machine-readable / summary-only |

By default it writes a *.min.ext copy and never touches the original. Use -w to overwrite. It never produces a larger file — if compression can't beat the input, the original is kept.

Idempotency: with --overwrite, repeated runs would re-compress already-compressed files and slowly degrade them. --cache prevents this by recording the sha256 of every output and skipping matches on the next run.

Library

import { compress } from "mytinypng"; // re-exports mytinypng-core

const { data, compressedSize, ratio, skipped } = await compress(buffer, {
  format: "keep",      // "jpeg" | "png" | "webp" | "avif"
  quality: 80,         // omit for per-format defaults
  targetSsim: 0.99,    // optional smart mode
});

License

MIT