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

sv-ocr

v1.0.1

Published

The best ocr in the world !

Downloads

4

Readme

🔍 sv-ocr

npm version npm downloads License: MIT

Perform text recognition (OCR) from images using Node.js — either as a function or a REST API server.

Ideal for document processing, attendance systems, kiosks, or AI pre-processing pipelines.


✨ Features

  • 🚀 Use as a Node.js function or launch as a web server
  • 📤 Supports local file paths and image uploads
  • 🖼️ Works with most standard image formats (JPG, PNG, etc.)
  • 📦 Lightweight and fast

📦 Installation

npm install sv-ocr

Note: This package is ESM-only. Make sure to include "type": "module" in your package.json.

{
  "type": "module"
}

🚀 Quick Start

1️⃣ Use as a Function

import { recognizeText } from 'sv-ocr';

const results = await recognizeText('/absolute/path/to/image.png');
console.log(results);

2️⃣ Use as an API Server

import { startOcrServer } from 'sv-ocr';

startOcrServer(3600); // Starts Express server on port 3600

🌐 API Endpoints

| Method | Route | Description | | ------ | ------------- | ---------------------------- | | GET | /ocrByPath | OCR from local image path | | POST | /ocr-upload | OCR from uploaded image file |

🔗 Example: GET /ocrByPath

curl "http://localhost:3600/ocrByPath?imagePath=/full/path/image.jpg"

🔗 Example: POST /ocr-upload

curl -X POST http://localhost:3600/ocr-upload \
  -F "image=@./image.png"

📚 API Methods

startOcrServer(port: number): void

Launches an Express server with two OCR routes.


recognizeText(imagePath: string): Promise<OCRResult[]>

Performs OCR on a local image path.


🧾 Output Schema

Each OCR result is an object with the following structure:

type OCRResult = {
  text: string;         // Detected text string
  mean: number;         // Confidence score (0 to 1)
  box: [                // Bounding box (4-point polygon)
    [number, number],   // Top-left
    [number, number],   // Top-right
    [number, number],   // Bottom-right
    [number, number]    // Bottom-left
  ];
};

🖥 CLI Mode

npm install -g sv-ocr

Extract text directly from an image:

sv-ocr ./path/to/image.jpg

🌐 API Server Mode

Start a REST API server:

sv-ocr-server

Two endpoints will be available:

GET /ocrByPath

curl "http://localhost:3600/ocrByPath?imagePath=/absolute/path/to/image.jpg"

POST /ocr-upload

curl -F "image=@/path/to/image.jpg" http://localhost:3600/ocr-upload

📁 Notes

  • The imagePath for /ocrByPath must be absolute.
  • Uploaded files are stored temporarily in the uploads/ folder.
  • For best results, use high-contrast images with minimal noise.

🛡 License

MIT


👨‍💼 Author

Made with ❤️ by Vaibhav Panday

Found this useful? Star the repo or buy me a coffee ☕ PRs and feedback welcome!