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

unocr

v0.1.1

Published

Unified OCR across native, CLI, browser, Tesseract, and AI vision engines with structured HTML or hast output

Readme

unocr

npm version npm downloads npm license

The OCR layer of By Sages Typography — one manager and result model for native system engines, Tesseract, browser Shape Detection, and AI vision models, with universal image input and structured output.

Features

  • 🚗 One API, many engines — choose a driver explicitly or let auto probe native OCR, the Tesseract CLI, and Tesseract.js in order; AI remains an explicit opt-in model.
  • 🧾 Structured results — drivers normalize engine output into an OCR document; consume it as escaped HTML by default or as a typed hast tree with outputType: "hast".
  • 🖼 Universal input — URLs, data URLs, blobs, streams, responses, and binary views are normalized through undio, so drivers do not each need bespoke file handling.
  • ⚡ Batch-aware execution — managers reuse workers where possible, schedule parallel recognition, expose dispose(), and keep long-running Tesseract work off your application code.
  • 🖥 Real system OCR — VisionKit on macOS and Windows Media OCR are available through an optional native peer; no model download is required where the OS provides the engine.
  • 🤖 AI when needed — connect any AI SDK-compatible vision model and prompt it for structured HTML while keeping the same downstream result API.

Installation

# pnpm
pnpm add unocr
pnpm add tesseract.js

# npm
npm install unocr tesseract.js

# yarn
yarn add unocr tesseract.js

# bun
bun add unocr tesseract.js

Only install the engine you need: tesseract.js, @napi-rs/system-ocr, and ai are optional peer dependencies. The CLI driver uses a locally installed tesseract binary, and the browser driver uses the Shape Detection API directly.

Driver Selection

| Driver | Runtime | Engine / dependency | Best for | | ----------- | ----------------------- | --------------------------- | ------------------------------------------ | | auto | Node | native → CLI → Tesseract.js | applications that should work across hosts | | native | Node (macOS / Windows) | @napi-rs/system-ocr | fast OS OCR without downloading models | | cli | Node | tesseract executable | existing local Tesseract installations | | tesseract | Node / browser / worker | tesseract.js | portable WASM OCR and workers | | web | Browser | Shape Detection API | browsers that expose TextDetector | | ai | Universal | AI SDK vision model | complex layouts when a model is acceptable |

Quick Start

Let the runtime pick an available backend:

import { createOCRManager } from "unocr";
import autoDriver from "unocr/drivers/auto";

const ocr = createOCRManager({ driver: autoDriver() });
const result = await ocr.recognize(image);
const results = await ocr.recognizes(images, { parallel: 4 }); // bounded by 4 by default
await ocr.dispose();

Pin Tesseract.js when predictable WASM behavior matters more than host-specific speed:

import { createOCRManager } from "unocr";
import tesseractDriver from "unocr/drivers/tesseract";

const ocr = createOCRManager({
  driver: tesseractDriver({
    langs: ["eng", "chi_sim"],
    logger: (message) => console.log(message),
  }),
});

const result = await ocr.recognize(image);
await ocr.dispose();

For document-oriented processing, request hast instead of parsing HTML again:

import { createOCRManager } from "unocr";
import tesseractDriver from "unocr/drivers/tesseract";

const ocr = createOCRManager({
  driver: tesseractDriver({ langs: "eng", outputType: "hast" }),
});

License