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

@awesome-compressor/browser-compress-image

v0.0.6

Published

Browser image compression library with TypeScript support, multiple output types, and pluggable tool selection.

Readme

Browser Compress Image

Browser Compress Image

一个浏览器端图片压缩库,支持多压缩路径、多输出类型、目标驱动压缩、队列化增 强压缩,以及生成式状态页、行为契约文档和基线可选的评估流程。

当前状态(npm 0.0.5):主线程压缩、队列管理、预处理和多工具比对已经可 直接使用;Worker 压缩仍然是实验性能力,默认关闭。

README 现在只承担定位、安装、快速开始和状态入口。能力矩阵与公开行为契约 统一放在 docs/specs/

安装

npm install @awesome-compressor/browser-compress-image

快速开始

当你想拿到最终结果,同时保留工具选择、体积变化和决策解释时,用 compressDecision()

import { compressDecision } from '@awesome-compressor/browser-compress-image'

const decision = await compressDecision(file, {
  objective: {
    targetBytes: 300 * 1024,
    goal: 'balanced',
    output: 'auto',
  },
  type: 'file',
})

console.log(decision.result)
console.log(decision.bestTool)
console.log(decision.outputDecision)
console.log(decision.objectiveDecision)

当你想直接使用内建工具选择、只拿压缩结果时,用 compress()

import { compress } from '@awesome-compressor/browser-compress-image'

const result = await compress(file, {
  quality: 0.8,
  output: 'auto',
  type: 'blob',
})

当你想明确控制允许参与压缩的工具集合时,用 compressWithTools()

import {
  compressWithTools,
  registerCanvas,
  registerCompressorJS,
} from '@awesome-compressor/browser-compress-image'

registerCanvas()
registerCompressorJS()

const result = await compressWithTools(file, {
  quality: 0.8,
})

当你需要队列化执行和预处理时,用 compressEnhanced()

import { compressEnhanced } from '@awesome-compressor/browser-compress-image'

const result = await compressEnhanced(file, {
  quality: 0.8,
  useQueue: true,
  preprocess: {
    maxWidth: 1920,
    maxHeight: 1080,
  },
})

当你需要任务句柄、取消和阶段订阅时,用 compressJob()

import { compressJob } from '@awesome-compressor/browser-compress-image'

const job = compressJob(file, {
  quality: 0.8,
})

job.onStageChange((stage) => {
  console.log(stage)
})

const result = await job.promise

文档

契约与提案

当前要点

  • preserveExif: true 只会保留支持 EXIF 的内建工具
  • output 已提供 phase-1 preserve | auto | jpeg | png | webp
  • objective 已提供 phase-1 targetBytes + goal + output
  • compressDecision() 已提供 beta 级可解释单结果入口
  • compressEnhanced() 默认走队列化执行
  • compressJob() 已提供 beta 级任务句柄
  • configureCompressionDeployment() 已提供 beta 级统一部署配置
  • assessQuality()buildConversionColumn() 已支持非原图 baseline 的评估
  • compressEnhanced({ useWorker: true }) 是 best-effort,不是强制 worker-only
  • docs/status.md 才是能力矩阵和导出状态入口,不再由 README 手工维护

贡献

如果改动影响公开行为,请在同一个变更里同步更新对应的 specs/*.mdspecs/capabilities.yaml

许可证

MIT License © 2022-2025 Simon He