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

docutext

v1.2.1

Published

Zero-dependency TypeScript PDF text extraction for RAG and AI pipelines

Readme

docutext

npm version bundle size license

Zero-dependency PDF text extraction built for RAG and AI pipelines. Parses PDFs from scratch -- no PDF.js, no WASM, no native addons. Works in Node.js and the browser.

Performance

| Library | Small PDF (31 KB) | Large PDF (1.3 MB) | Bundle (gzip) | Dependencies | |---------|------------------:|-------------------:|--------------:|:-------------| | docutext | 3 ms | 40 ms | ~24 KB | 0 | | pdfjs-dist | 5 ms | 244 ms | ~1.3 MB | 0 (but large) | | pdf-parse | 5 ms | 279 ms | ~780 KB | 1 (pdfjs) | | unpdf | 6 ms | 232 ms | ~320 KB | 2 (pdfjs) |

Median of 3 runs, Node.js, Apple Silicon.

docutext is purpose-built for text extraction in RAG/AI workflows -- not a general PDF toolkit. It does one thing and does it fast.

Install

# Node.js (zero dependencies)
pnpm add docutext

# Browser / bundler (add fflate for decompression, ~3 KB gzip)
pnpm add docutext fflate

Requires Node.js 18+. Browser builds target ES2020+.

Quick Start

import { DocuText } from 'docutext';

const doc = await DocuText.load('document.pdf');
console.log(doc.text);

Structured Markdown

import { DocuText } from 'docutext';
import { docToMarkdown, pageToMarkdown } from 'docutext/markdown';

const doc = await DocuText.load('document.pdf');
console.log(docToMarkdown(doc));       // headings, bold, links
console.log(pageToMarkdown(doc.pages[0]));

Browser

import { DocuText } from 'docutext';

const response = await fetch('/document.pdf');
const bytes = new Uint8Array(await response.arrayBuffer());
const doc = DocuText.fromBuffer(bytes);
console.log(doc.text);

Page-by-page

for (const page of doc) {
  console.log(`Page ${page.number}: ${page.text}`);
}

Layout-Fidelity Opt-In

import { DocuText } from 'docutext';

const doc = await DocuText.load('document.pdf', { textMode: 'layout' });
console.log(doc.text);

textMode: 'layout' keeps more literal spacing and text-object behavior. The default textMode: 'clean' favors semantic text reconstruction and fixes fragmented form PDFs.

Key Features

  • Zero dependencies in Node.js. Single optional peer dep (fflate) for browser.
  • ~24 KB gzipped browser bundle -- 50x smaller than pdfjs-dist.
  • 6x faster than alternatives on real-world documents.
  • Clean semantic text by default -- fragmented form PDFs are reconstructed without spurious intra-word splits.
  • Plain text + structured markdown output (headings inferred from font size, bold/italic, links).
  • Opt-in layout fidelity mode via textMode: 'layout' when you want more literal spacing/object ordering.
  • Column-aware text flow -- side-by-side columns (e.g. signature blocks) are read column-first to keep related data together.
  • Lazy extraction -- accessing page.text only processes that page.
  • Full PDF parsing -- xref tables, stream filters, font encodings, ToUnicode CMaps, form XObjects.
  • Encrypted PDF support -- handles permission-encrypted PDFs (empty password, RC4/AES-128).
  • Runs everywhere -- Node.js and browser via conditional exports.
  • ESM only -- modern module system, tree-shakeable.
  • TypeScript first -- full type definitions included.

Documentation

For the full API reference, architecture details, and a live playground, see the documentation site.

Security

Please see SECURITY.md for vulnerability reporting guidance.

License

MIT