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

layro

v0.2.0

Published

CLI tools for AI agents to extract local text and run OCR on images

Downloads

430

Readme

layro

layro 是一个面向 AI Agent 和自动化流程的小型 CLI,目标是把本地文件处理里那些高频、低价值、容易反复折腾的部分,收敛成稳定命令。

当前提供两类能力:

  • extract:提取本地文件中的可读文本
  • ocr:识别本地图像中的文字

它不是一个“大而全”的文档平台,而是一个给 Agent 用的、接口稳定的本地文本摄取层。

English README

这个项目解决什么问题

你把一个本地文件交给 Agent 后,经常会发生同样的事:

  1. Agent 先猜该装哪个包
  2. 再写一点临时脚本
  3. 然后输出格式还不稳定

layro 想做的事很简单:把这层摩擦拿掉。

安装

npm install -g layro

也可以直接用:

npx layro extract ./resume.pdf
npx layro ocr ./screenshot.png

命令

extract

用于提取本地文件中的可读文本。

当前支持:

  • pdf
  • docx
  • html
  • txt
  • md

示例:

layro extract ./resume.pdf
layro extract ./resume.pdf --json
layro extract ./report.docx --output ./report.txt
layro extract ./notes.custom --type txt

ocr

用于识别本地图像中的文字。

当前范围:

  • 处理图片,不处理原生文本文件
  • 适合截图、扫描片段、图片导出、文字照片
  • 这一版还不包含扫描 PDF OCR

常见输入格式:

  • png
  • jpg / jpeg
  • webp
  • tiff
  • gif
  • 以及 sharp 可读取的其他图像格式

示例:

layro ocr ./receipt.png
layro ocr ./receipt.png --json
layro ocr ./mixed-language.png --lang eng+chi_sim
layro ocr ./single-line.png --psm SINGLE_LINE
layro ocr ./screenshot.jpg --output ./screenshot.txt

OCR 到底是针对图片还是文件

严格来说,OCR 识别的是“图像中的文字”。

所以更准确的说法不是“它针对文件还是文本”,而是:

  • 如果文件里本来就有文本层,用 extract
  • 如果文件本质上是图像,比如截图、照片、扫描图,用 ocr
  • 如果是带文本层的 PDF,用 extract
  • 如果是扫描 PDF,那本质上还是图片型文档,需要单独做 PDF OCR,这一版暂未支持

开发

要求:

  • Node.js >=18
  • pnpm >=10
pnpm install
pnpm test
pnpm build

本地 link 验证:

npm link
layro extract ./tests/fixtures/resume.pdf --json
npm unlink -g layro

文档

License

ISC