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

web-sdk-pp-ocrv6

v0.2.0

Published

PP-OCRv6 browser OCR runtime

Readme

web-sdk-pp-ocrv6

English · 在线 Demo · GitHub

框架无关的浏览器端 PP-OCRv6 SDK,使用 ONNX Runtime Web 在本地完成文本检测、文本识别和 det -> crop -> rec OCR。支持桌面和移动端浏览器、公众号 H5、微信小程序 web-view;不支持微信原生小程序 JavaScript/WASM runtime。

本文对应 [email protected]

安装

pnpm add [email protected]

也可以使用 npm install [email protected]

快速开始

import { createOCR } from "web-sdk-pp-ocrv6";

const ocr = createOCR({
  model: { det: "small", rec: "small" },
  backend: "wasm",
  execution: "worker",
  allowFallback: false,
  onProgress(event) {
    if (event.phase === "download" && event.progress !== undefined) {
      console.log(`模型下载 ${Math.round(event.progress * 100)}%`);
    }
  },
});

await ocr.load();
const result = await ocr.ocr(file);
console.table(result.lines);
await ocr.dispose();

onProgress 会报告 manifestcachedownloadintegrityloadinference 阶段。wasm 表示 CPU,webgpu 表示 GPU。显式选择严格执行;只有 backend: "auto"allowFallback: true 时,SDK 才可从 WebGPU 回退到 WASM。

0.2.0 新增能力

  • RuntimeOptions.wasmPaths 为 Worker 与主线程配置同版本 ORT 资源,自定义模型支持 preset 选择。
  • getModelCacheUsageresolveModelCacheIdentity 和可选 CacheWriter/createWriter 提供模型缓存容量、身份解析和清理时的写入失效控制。
  • initializationtimings.loadStateruntime.componentBackends 分别报告历史初始化、当前调用冷热状态及实际组件后端。

配置、取消/释放边界与字段语义见 API性能。独立示例固定使用 0.1.8,具体 API 范围与限制见各示例 README。

模型分发

npm 包包含 SDK、Worker、类型、manifest 和识别字典,不包含 ONNX 模型。浏览器默认从带 CORS 的固定版本地址下载模型,并校验文件大小和 SHA-256;也支持自定义 manifest 与自托管模型。

文档与示例

English

This document describes [email protected].

A framework-neutral browser SDK for PP-OCRv6 text detection, recognition, and the complete det -> crop -> rec OCR pipeline through ONNX Runtime Web. It targets desktop and mobile browsers, WeChat Official Account H5, and mini-program web-view. The native WeChat mini-program JavaScript/WASM runtime is not supported.

npm install [email protected]
import { createOCR } from "web-sdk-pp-ocrv6";

const ocr = createOCR({
  model: { det: "small", rec: "small" },
  backend: "wasm",
  execution: "worker",
  allowFallback: false,
});

await ocr.load();
const result = await ocr.ocr(file);
console.table(result.lines);
await ocr.dispose();

New in 0.2.0

  • RuntimeOptions.wasmPaths configures matching ORT resources in Workers and on the main thread; custom models support explicit preset selection.
  • getModelCacheUsage, resolveModelCacheIdentity, and optional CacheWriter/createWriter expose cache bytes, model identity, and cleanup invalidation for in-flight writes.
  • initialization, timings.loadState, and runtime.componentBackends report historical initialization, current cold/warm state, and actual component backends.

See API and Performance for configuration and cancellation/disposal boundaries. Standalone examples are pinned to 0.1.8; each example README documents its API scope and limitations.

The npm package contains the SDK, Worker, types, manifest, and recognition dictionaries, but no ONNX models. Browsers download pinned model assets with CORS support and verify their byte size and SHA-256 digest. Custom manifests and self-hosted models are supported.

See the English documentation, examples, and live Demo.

Apache-2.0. Model provenance and third-party notices are available in THIRD_PARTY_NOTICES.md.