Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ocr-space-api-wrapper

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ocr-space-api-wrapper

Node.js wrapper for ocr.space APIs.

  • 2.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16K
increased by13.85%
Maintainers
0
Weekly downloads
 
Created
Source

OCR.Space Node.js API wrapper

Coverage Status npm Donate

NPM

Node.js wrapper for ocr.space APIs, a service for executing OCR (Optical Character Recognition) to images and PDFs.

Install

npm i ocr-space-api-wrapper

Usage

const { ocrSpace } = require('ocr-space-api-wrapper');

async function main () {
  try {
    // Using the OCR.space default free API key (max 10reqs in 10mins) + remote file
    const res1 = await ocrSpace('http://dl.a9t9.com/ocrbenchmark/eng.png');

    // Using your personal API key + local file
    const res2 = await ocrSpace('/path/to/file.pdf', { apiKey: '<API_KEY_HERE>' });
    
    // Using your personal API key + base64 image + custom language
    const res3 = await ocrSpace('data:image/png;base64...', { apiKey: '<API_KEY_HERE>', language: 'ita' });
  } catch (error) {
    console.error(error);
  }
}

Params

input string (required)

The input param specifies the input file (see examples above). It can be one of the following:

  • a remote URL address such as http://example.com/image.jpg;
  • a local file path such as /path/to/file.pdf;
  • a base64 image string such as data:image/png;base64....

options object

This param is an object with the following keys:

  • apiKey: your API key for ocr.space APIs. Default API key has a limit of max 10reqs in 10mins.
  • ocrUrl: a different URL for ocr.space APIs, for example when you purchase the PRO plan.
  • All other params as documented in the official website.

Response

This package does not change the response in any way, please refer to the official website.

Run lint

npm run lint

Run tests

npm test

Bug or feedback

Please open a new issue.

Author

Keywords

FAQs

Package last updated on 23 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc