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

deflato

v1.2.0

Published

Deflato — compress images & documents, generate and edit AI images

Downloads

20

Readme

Deflato

Compress images, documents, and generate AI images with one line of code. Powered by deflato.com.

Install

npm install deflato

Quick Start

const Deflato = require('deflato');
const client = new Deflato('your-api-key');

// Compress an image
const result = await client.compress('photo.jpg', {
  format: 'WEBP',
  quality: 75,
  maxDimension: 1920,
});
console.log(`Saved ${result.savingsPercent}% → ${result.outputPath}`);

// Compress a PDF document
const doc = await client.compressDocument('report.pdf', { quality: 70 });
console.log(`PDF: ${doc.savingsPercent}% smaller`);

// Generate an AI image
const img = await client.generate('A sunset over mountains', { model: 'fast' });
console.log(`Generated → ${img.outputPath}`);

// Edit an image with AI
const edited = await client.edit('Add sunglasses to the person', {
  filePath: 'portrait.jpg',
  model: 'fast',
});
console.log(`Edited → ${edited.outputPath}`);

// Get alt-text for an image
const desc = await client.describe({ filePath: 'photo.jpg' });
console.log(desc.description);

API

new Deflato(apiKey, options?)

| Option | Default | Description | |---|---|---| | baseUrl | https://deflato.com | API base URL |


client.compress(inputPath, options?)

Compress an image file.

| Option | Default | Description | |---|---|---| | output | auto | Output file path | | quality | 80 | Quality 1-100 | | maxDimension | 0 | Max width/height (0 = no resize) | | format | JPEG | JPEG, PNG, WEBP, or AVIF | | stripExif | true | Remove EXIF metadata |

Returns { success, inputSize, outputSize, savingsPercent, format, outputPath }


client.info(inputPath, options?)

Get compression info without saving the file.

| Option | Default | Description | |---|---|---| | quality | 80 | Quality 1-100 | | maxDimension | 0 | Max width/height | | format | JPEG | Output format |

Returns { success, input_size, output_size, input_dimensions, output_dimensions, savings_percent }


client.compressBatch(inputPaths, options?)

Compress multiple files sequentially. Same options as compress() + outputDir.

Returns array of compress results.


client.compressDocument(inputPath, options?)

Compress images inside PDF, DOCX, PPTX, or XLSX documents.

| Option | Default | Description | |---|---|---| | output | auto | Output file path | | quality | 75 | Image quality 1-100 | | maxDimension | 1920 | Max image dimension in px |

Returns { success, inputSize, outputSize, savingsPercent, outputPath }


client.convertFormat(inputPath, outputFormat, options?)

Convert an image to a different format (JPEG, PNG, WEBP, AVIF).

| Option | Default | Description | |---|---|---| | output | auto | Output file path |

Returns same as compress().


client.generate(prompt, options?)

Generate an image from a text prompt using AI.

| Option | Default | Description | |---|---|---| | model | photo | fast, photo, design, or icon | | aspectRatio | 1:1 | Aspect ratio | | style | any | Style for design/icon models | | resolution | 1K | 1K, 2K, or 4K (photo only) | | format | png | png or jpg | | output | auto | Output file path |

Returns { success, outputPath, outputSize, model, prompt }


client.edit(prompt, options)

Edit an existing image using AI instructions (img2img).

| Option | Default | Description | |---|---|---| | filePath | — | Path to local image file | | imageUrl | — | URL of the image (alternative) | | model | fast | fast (~10s) or precise (~30s) | | format | png | png or jpg | | output | auto | Output file path |

Provide either filePath or imageUrl.

Returns { success, outputPath, outputSize, model, prompt }


client.describe(options)

Generate AI alt-text / caption for an image. Free — no rate limit.

| Option | Default | Description | |---|---|---| | filePath | — | Path to local image file | | imageUrl | — | URL of the image (alternative) |

Returns { success, description }


Supported Formats

Image input: JPEG, PNG, WEBP, HEIC, TIFF, BMP, GIF, RAW (20+ formats)

Image output: JPEG, PNG, WEBP, AVIF

Document input: PDF, DOCX, PPTX, XLSX

Get an API Key

Sign up at deflato.com/account to get your free API key.

License

MIT