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

hyper-compress-wasm

v1.0.0

Published

Hyper Compress PDF engine compiled to WebAssembly. Runs on any platform, no native binaries.

Readme

hyper-compress-wasm

Hyper Compress is a high fidelity, content preserving PDF compression engine which maintains PDF conformance.

Native or WebAssembly

The same engine ships two ways. hyper-compress contains prebuilt native binaries.

Pick native on a supported platform, especially for servers compressing untrusted uploads at volume. Pick wasm for portability (Intel macOS, ARM Linux, FreeBSD, Alpine), when you cannot ship native binaries, or when you work with buffers rather than files.

Install

npm install hyper-compress-wasm

Node 22 or newer, ESM only. No postinstall scripts, no downloads: the WebAssembly module ships inside the package.

Quick start

import { readFile, writeFile } from 'node:fs/promises';
import { compress } from 'hyper-compress-wasm';

const input = new Uint8Array(await readFile('input.pdf'));
const result = await compress(input, { preset: 'medium' });

await writeFile('output.pdf', result.data);
console.log(`${result.originalSize} -> ${result.compressedSize} bytes`);

API

compress(input, opts?)

Compresses one PDF held in a Uint8Array. Returns a Promise<HyperWasmResult>.

interface HyperWasmOptions {
  preset?: 'low' | 'medium' | 'high' | 'lossless'; // default 'medium'
  options?: Partial<HyperCompressOptions>;         // overrides applied on top of the preset
  password?: string | null;                        // password for encrypted input
  targetSizeBytes?: number;                        // aim for a size; see metTarget on the result
}

interface HyperWasmResult {
  data: Uint8Array;          // the output PDF, never larger than the input
  originalSize: number;
  compressedSize: number;
  signed: boolean;           // true when the input was digitally signed and returned untouched
  pdfa: PdfaLevel | null;    // the input's PDF/A claim, e.g. { part: 2, conformance: 'b' }
  pdfaOutcome: 'none' | 'preserved' | 'claim-withdrawn';
  metTarget: boolean | null; // whether targetSizeBytes was met; null when no target was set
  warnings: string[];        // options requested but skipped, e.g. rasterize dropped to keep PDF/A
}

Errors are thrown as HyperError with a typed code: decrypt_failed for a wrong or missing password, engine_error for anything else.

HyperCompressOptions and its presets are identical to the native package; every option is documented in the hyper-compress README.

verifyPassword(input, password)

Checks a password against an encrypted PDF without compressing it. Returns Promise<boolean>. A true here means compress() will accept the same password.

Helpers

HYPER_PRESETS, normalizeHyperOptions and buildHyperTokens are re-exported unchanged from the native SDK.

Blocking and worker threads

Compression runs synchronously inside your process once the module is loaded; a large document can hold the event loop for several seconds. Its recommended to run it inside a worker_thread:

// worker.js
import { parentPort, workerData } from 'node:worker_threads';
import { compress } from 'hyper-compress-wasm';

const result = await compress(new Uint8Array(workerData.input), workerData.opts);
parentPort.postMessage(result, [result.data.buffer]);

This also restores crash isolation: if hostile input takes down the engine, it takes down the worker thread, not your server. If you want that managed for you, with subprocess isolation, timeouts and AbortSignal cancellation built in, use the native package.

License

AGPL-3.0-only. For use in proprietary products, a commercial license is available; contact us at [email protected]. Bundled third-party components keep their own licenses; see NOTICE.md.