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

@scribe.js/aws-textract

v0.1.0

Published

AWS Textract adapter for Scribe.js OCR.

Readme

@scribe.js/aws-textract

Convert AWS Textract output into searchable PDFs. AWS Textract recognition adapter for scribe.js-ocr, an open-source OCR and text-extraction toolkit for browser and Node.js.

scribe.js-ocr already knows how to parse Textract output into its OCR data model. This package is the thin client that calls AWS Textract and returns that output. It is kept separate so the AWS SDK is only installed by projects that actually use Textract.

Install

npm install scribe.js-ocr @scribe.js/aws-textract

Exports

| Specifier | Class | Environment | | --- | --- | --- | | @scribe.js/aws-textract | RecognitionModelTextract | Node. Imports the AWS SDK as a normal dependency. Supports per-image and async PDF (via S3) recognition. | | @scribe.js/aws-textract/browser | RecognitionModelTextractBrowser | Browser. Imports a pre-bundled AWS SDK, so no bare-specifier resolution is needed. Per-image recognition only. |

Usage

Pick the pattern that matches where your AWS credentials can safely live.

1. Node / server-side

Credentials stay on the server. Use the default export.

import scribe from 'scribe.js-ocr';
import { RecognitionModelTextract } from '@scribe.js/aws-textract';

await scribe.importFiles(['document.pdf']);

await scribe.recognize({
  model: RecognitionModelTextract,
  modelOptions: { analyzeLayout: true },
});

console.log(await scribe.exportData('text'));
await scribe.terminate();

Credentials and region resolve through the standard AWS SDK chain (AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY / AWS_REGION env vars, ~/.aws/credentials, or an IAM role), or pass them explicitly in modelOptions:

modelOptions: {
  region: 'us-east-1',
  credentials: { accessKeyId: '...', secretAccessKey: '...' },
}

Textract rate limits are per region, so passing an array of regions distributes pages round-robin for higher throughput:

modelOptions: { region: ['us-east-1', 'us-west-2', 'eu-west-1'] }

2. Browser via proxy server (recommended for production)

For a public browser app, the safe setup is to keep credentials off the client entirely. The browser sends each document to a backend you control, which runs the Node model from pattern 1 and streams results back. No AWS key ever reaches the client.

The scribe.js repository ships a ready-made client and server you can copy under the server-textract-proxy example (in scribe.js repo). The server holds the credentials and calls RecognitionModelTextract, and the browser uses a small proxy model that posts the document to your endpoint. This is the right default for most production sites.

3. Browser, direct to AWS (advanced / debugging)

The /browser export calls AWS straight from the browser with credentials you pass in. Those credentials reach the client, so this pattern is appropriate only for local debugging, trusted internal tools, or short-lived Amazon Cognito credentials (advanced users only). Never ship long-lived IAM keys to a public site — use pattern 2 instead.

import scribe from 'scribe.js-ocr';
import { RecognitionModelTextractBrowser } from '@scribe.js/aws-textract/browser';

await scribe.importFiles(fileList);

await scribe.recognize({
  model: RecognitionModelTextractBrowser,
  modelOptions: {
    region: 'us-east-1',
    credentials: { accessKeyId: '...', secretAccessKey: '...' },
    analyzeLayout: true,
  },
});

console.log(await scribe.exportData('text'));

Options

modelOptions accepted by recognize():

  • analyzeLayout (boolean) — enable layout analysis. Increases AWS cost.
  • analyzeTables (boolean) — enable table analysis. Implies layout analysis. Significantly increases AWS cost.
  • region (string | string[]) — AWS region, or an array for multi-region throughput.
  • credentials ({ accessKeyId, secretAccessKey }) — explicit credentials.

The Node RecognitionModelTextract additionally supports async PDF recognition (recognizeDocument), which uploads to S3 and polls the async Textract API. See the JSDoc in RecognitionModelAwsTextract.js for s3Bucket, pollingInterval, and related options.

Rebuilding the browser bundle

aws-textract.esm.bundle.min.js is a checked-in build artifact: the AWS SDK Textract client bundled for the browser. Regenerate it after bumping the AWS SDK version:

npm install
npm run build

The declared @aws-sdk/* dependency versions and the bundled version must be kept in sync. Both should match after a fresh npm install && npm run build.