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

clawpdf

v0.3.2

Published

Zero-dependency PDFium WASM bindings for PDF text extraction and page rendering.

Downloads

18,954,423

Readme

clawpdf 🦞 — Pull the text and pixels out of PDFs

clawpdf banner

CI npm Node.js License Docs

ClawPDF is an ESM-only PDFium WebAssembly library and CLI for Node.js and bundled browser apps. It extracts text, renders pages, and produces PNG bytes without runtime dependencies, native addons, postinstall scripts, or a canvas package.

Install

npm install clawpdf

Node.js 22 or newer is required. The package includes the clawpdf command and its PDFium WebAssembly runtime.

Quick start

Extract text from a PDF without writing a script:

$ npx clawpdf https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf
Dummy PDF file

Or open a local file from JavaScript and render its first page:

import { writeFile } from "node:fs/promises";
import { openPdf } from "clawpdf";

await using pdf = await openPdf("report.pdf");
console.log(pdf.text({ maxPages: 5 }));

const png = await pdf.page(1).png({ dpi: 144, forms: true });
await writeFile("page-1.png", png);

Page numbers in the CLI and library are one-based.

CLI

The CLI reads file paths, URLs, and standard input. Text goes to stdout; diagnostics go to stderr.

| Task | Command | | --- | --- | | Extract text | clawpdf report.pdf | | Read standard input | cat report.pdf \| clawpdf - | | Emit structured output | clawpdf report.pdf --json | | Render one page | clawpdf render report.pdf --page 1 -o page.png |

HTTP(S) downloads have no size cap by default. Opt into a byte budget with --fetch-max-bytes 10000000 or the library's fetchMaxBytes option. 0 disables the budget; the existing 30-second deadline still applies.

See the CLI reference for extraction modes, page selection, passwords, image budgets, inline terminal images, JSON output, and exit codes.

Text-first extraction

extractPdf() can return text, PNG fallback images, or both. In auto mode it always extracts text, then renders selected pages only when the text is shorter than minTextChars.

import { extractPdf } from "clawpdf";

const result = await extractPdf("report.pdf", {
  mode: "auto",
  maxPages: 20,
  minTextChars: 200,
  image: { dpi: 96, maxPixels: 4_000_000, forms: true },
});

console.log(result.text, result.images);

Image results contain raw PNG bytes. The optional clawpdf/adapters export converts them to data URLs or model-message content blocks. See extraction fallback for the modes, limits, and result shape.

Reuse an engine

openPdf() owns a private engine and suits one-off work. Servers should create one engine, reuse it across documents, and dispose it during shutdown:

import { createEngine } from "clawpdf";

export async function inspect(pdfBytes: Uint8Array) {
  await using engine = await createEngine();
  await using pdf = await engine.open(pdfBytes);

  console.log(pdf.metadata.title);
  console.log(pdf.page(1).text());
}

The Node entry point accepts byte arrays, file paths, URLs, and blobs. Bundled browser code should import the pre-wired clawpdf/browser entry point; see browser and bundler setup.

Documentation

The full documentation site is available at clawpdf.dev.

Development

pnpm install
pnpm build
pnpm typecheck
pnpm test
pnpm test:package
pnpm docs:site

CI runs the same checks on Node.js 22, 24, and 26.

License

MIT. PDFium carries upstream BSD-style and Apache-2.0 notices; see THIRD_PARTY_NOTICES.md.