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

@empellio/image-optimizer

v0.1.0

Published

Server-side image optimization middleware for Node.js (inspired by the Next.js Image API). Sharp-powered resizing, format conversion (AVIF, WebP, JPEG, PNG), HTTP cache headers, and pluggable caching (memory, disk, Redis).

Downloads

5

Readme

@empellio/image-optimizer

Server-side image optimization library (inspired by the Next.js Image API).

Installation

npm i @empellio/image-optimizer sharp got

Quick start

import express from "express";
import { createImageOptimizer } from "@empellio/image-optimizer";

const app = express();

const optimizer = createImageOptimizer({
  cache: { type: "disk", path: "./.cache/images", ttl: 60 * 60 * 24 },
  formats: ["webp", "avif", "jpeg", "png"],
  maxWidth: 4000,
  maxHeight: 4000,
  defaultQuality: 80,
});

app.use("/image", optimizer.express());

app.listen(3000);

Fastify

import Fastify from "fastify";
import { createImageOptimizer } from "@empellio/image-optimizer";

const fastify = Fastify();
const optimizer = createImageOptimizer();

fastify.register(optimizer.fastify(), { prefix: "/image" });

fastify.listen({ port: 3000 });

Request

GET /image?url=https://example.com/photo.jpg&w=800&h=600&fit=crop&format=webp&quality=80

Parameters

  • url: source image (URL, local path, or uploaded buffer)
  • w: target width (optional)
  • h: target height (optional)
  • fit: cover | contain | fill | inside | outside | crop (default: cover)
  • format: webp | avif | jpeg | png (default: keep original)
  • quality: 1–100 (default: 80)
  • crop: smart (attention-based) or center (default)
  • bg: background color (used when flattening transparent images)
  • blur: blur radius (e.g., for placeholders)
  • grayscale: convert to grayscale
  • rotate: rotation in degrees (e.g., 90, 180)
  • placeholder: blur to generate a 10px blurred placeholder

Programmatic usage

import { createImageOptimizer } from "@empellio/image-optimizer";

const optimizer = createImageOptimizer();
const result = await optimizer.process({ buffer, format: "webp", w: 300 });

Tests & build

npm run test
npm run build

Demo servers

  • Express demo: npm run demo:express → http://localhost:3001
  • Fastify demo: npm run demo:fastify → http://localhost:3002
# run demo servers
npm run demo:express
npm run demo:fastify