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

@ztools-center/wechat-ocr-native

v0.1.0

Published

Node.js native addon for local WeChat OCR via wcocr

Readme

wcocr Node.js 原生扩展

English | 简体中文

这是一个用于本地调用微信 OCR 的 Node.js 原生扩展。macOS 下会直接调用打包的 微信 libwxocr.dylib;Windows 下仍可调用已有的 wcocr C ABI:

  • wechat_ocr(...)
  • stop_ocr()

Windows 下会动态加载 wcocr.dll。macOS 下会加载 vendor/wechat-ocr-mac/lib/libwxocr.dylib

免责声明

本项目是独立的社区项目,与腾讯或微信无关联,也未获得腾讯或微信的认可、赞助或 背书。WeChat、微信、Weixin 及相关名称归其各自权利人所有。

本项目可能会加载或打包第三方运行时文件,例如微信 OCR 动态库和模型文件。在使用、 分发或发布任何包含这些文件的包之前,请确认你拥有必要的权利,并遵守适用的许可、 服务条款和当地法律法规。使用本项目所产生的风险由使用者自行承担。

构建

npm install
npm run build

运行

Windows 微信 4.x 示例:

node test.js D:\test.png "%APPDATA%\Tencent\xwechat\XPlugin\plugins\WeChatOcr\8011\extracted\wxocr.dll" "C:\Program Files\Tencent\Weixin\4.0.0.26" .\wcocr.dll

macOS 本地示例:

node test.js ./test.png

在 macOS 上,ocr() 会直接使用打包的微信 libwxocr.dylib。当 vendor/wechat-ocr-mac 已准备好后,它不会启动 wxocr 辅助进程,也不会在运行时 读取 /Applications/WeChat.app

npm install
npm run build
node test.js ../mac-ocr-test.png

当前 macOS 状态:打包的微信 libwxocr.dylib 路径已在本地可用,并配合 text_det_fp16_v1.xnettext_rec_fp16_v2.xnetcharset_zh10798.txt 工作。

Windows 也可以使用环境变量:

export WCOCR_LIB_PATH=/path/to/wcocr.dll
export WECHAT_OCR_EXE=/path/to/wxocr.dll
export WECHAT_DIR=/path/to/wechat/runtime
node test.js ./test.png

JavaScript API

const wcocr = require('./index');

const result = wcocr.ocr({
  imagePath: './test.png'
});

console.log(result.text);
wcocr.stop();

Windows 下,ocrExewechatDir 会在调用 wechat_ocr 前从 UTF-8 转为 UTF-16,以匹配导出的 LPCTSTR ABI。

macOS 下需要准备的本地微信 OCR 文件如下:

  • vendor/wechat-ocr-mac/lib/libwxocr.dylib
  • vendor/wechat-ocr-mac/lib/libmmmojo.dylib
  • vendor/wechat-ocr-mac/models/text_det_fp16_v1.xnet
  • vendor/wechat-ocr-mac/models/text_rec_fp16_v2.xnet
  • vendor/wechat-ocr-mac/models/charset_zh10798.txt