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

@solidus-network/id-extract

v0.1.0

Published

Client-side (browser WASM) ID-document extraction: barcode read (zxing-wasm) + MRZ OCR (tesseract.js) + checksum reconstruction + confidence gate. Framework-free; the shared boundary with the embeddable capture SDK.

Readme

@solidus-network/id-extract

Client-side (browser WASM) ID-document extraction: barcode decode + MRZ OCR with checksum-validated reconstruction. Framework-free, dependency-light, both WASM engines lazy — nothing heavy loads at import. This is the extraction core inside @solidus-network/capture; use it directly when you already have your own capture UI.

npm i @solidus-network/id-extract

Usage

import { extractDocument } from '@solidus-network/id-extract'

// image: File | Blob | ArrayBuffer | Uint8Array | ImageData | canvas | URL string
const result = await extractDocument(image, { docType: 'national-id', side: 'back' })

if (result.fields) {
  // checksum-valid MRZ read — safe to autofill
  console.log(result.fields.firstName, result.fields.lastName, result.fields.birthDate)
} else if (result.barcodes.length > 0) {
  // error-corrected barcode payloads (PDF417 / QR / DataMatrix / Code128)
  console.log(result.barcodes)
} else {
  // result.needsServerFallback === true — route the raw frame to your own
  // server OCR; nothing on-device was checksum-valid
}

Data-source priority: barcode > MRZ — error-corrected symbologies beat OCR. MRZ reads pass through a ported, test-covered checksum-reconstruction: only reads whose ICAO check digits validate on the actually-OCR'd characters return fields; everything else honestly reports confidence: 'low', needsServerFallback: true.

What it covers — honestly

  • TD1 (ID-1 cards — national IDs, residence permits, many driving licenses): full on-device MRZ reconstruction with check-digit validation and single-character error correction.
  • TD3 (passports) / TD2: not reconstructed on-device yet. OCR candidate lines are returned in rawLines, but fields stays null — ride your server fallback for passports today.
  • Barcodes are decoded, not parsed{ format, text }, no AAMVA field mapping.
  • OCR quality depends on the input frame: feed the MRZ band at ≥ ~1500 px width for reliable reads (the @solidus-network/capture widget's guide/crop does this for you).

Engine loading

  • zxing-wasm/reader and tesseract.js are dynamic imports — first call pays the boot, later calls reuse a singleton worker (getMrzWorker() / terminateMrzWorker() are exported for control).
  • tesseract.js fetches its WASM core + eng.traineddata from its package defaults (network, a few MB, browser-cached). Self-host via extractDocument(image, { ocr: { langPath, cachePath, gzip } }).
  • Works in Node too (pass a Buffer/Uint8Array of an encoded image) — handy for tests.

Exports

extractDocument — the one-call pipeline above. Lower-level pieces: readDocumentBarcodes, recognizeMrz, filterMrzCandidates, reconstructTd1, gradeReconstruction, preprocessBand (+ grayscale, contrastStretch, cropBand — pure RGBA helpers).

Status

0.1.x beta. No accuracy numbers are quoted because we have not published measured ones. Apache-2.0.