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

@listen-fire/document-ai

v0.12.6

Published

The ocr slot's module on Google Document AI (`@lf/document-ai`): a scanned PDF's or an image's text, online for short files and batched through a Cloud Storage bucket for long ones, exactly as the platform reads them (packages/ocr-google), each read price

Readme

@lf/document-ai

The ocr slot on Google Document AI: the text of a scanned PDF or an image. With it, extract(…) reads a deck that is only pictures of pages, and a plugin's ctx.ocr reads the PDFs it fetches.

It is the platform's own Document AI reader (packages/ocr-google), served as a module:

  • a file of up to 15 pages and 20 MB goes to the processor's online endpoint;
  • a longer one is uploaded to your Cloud Storage bucket, processed in batch, read back and deleted.

lf asks it only of a file that needs it: an image, or a PDF with no usable text layer of its own (lf reads a born-digital PDF's text itself, by the platform's rule).

Install

  1. Install @listen-fire/document-ai into the project's externals folder and keep lf-external.yaml (shipped in the package) beside it, as externals/document_ai/lf-external.yaml.

  2. Name it in lf.yaml:

    core:
      ocr: document_ai
  3. Run lf connect document_ai to give it its settings. They go to the project's secrets file (or LF_SECRET__DOCUMENT_AI__<SETTING> in containers and CI), never into lf.yaml.

Settings

| setting | meaning | |---|---| | project | the Google Cloud project the OCR processor is in | | location | where the processor lives: eu or us | | processor_id | the processor's id (Document AI → Processors; an Enterprise Document OCR processor) | | bucket | a Cloud Storage bucket for files past 15 pages or 20 MB. Empty: such a file is refused, naming the setting | | client_email, private_key | a service account (the key is secret) with Document AI and the bucket's object roles. Leave both empty to use the environment's own Google credentials (a workload identity, gcloud auth application-default login) | | price_per_page | what a page costs you, in dollars. Default 0.0015, the list price ($1.50 per 1,000 pages) | | base_url, storage_url | other endpoints speaking Document AI's REST API and Cloud Storage's (a proxy); empty for Google's |

Cost

Every read reports its cost: the pages Document AI read times price_per_page, labelled document-ai/ocr. lf adds it to the run's spend, so maxRunCostUsd counts it. The module publishes the price (ocr.prices), so lf refuses before reading a file whose pages alone cost more than the run has left.

Tests

pnpm test in this folder starts the module as the process lf starts and runs the ocr slot's conformance kit and the module's own cases against a fake Document AI and Cloud Storage, driven by Google's own clients. A generated service account key signs its own tokens, so nothing reaches Google.