Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mindee/mindee-api-nodejs
Mindee API Helper Library for Node.js
https://github.com/mindee/mindee-api-nodejs
api-client nodejs ocr ocr-api sdk
Last synced: 7 days ago
JSON representation
Mindee API Helper Library for Node.js
- Host: GitHub
- URL: https://github.com/mindee/mindee-api-nodejs
- Owner: mindee
- License: mit
- Created: 2020-11-24T16:28:29.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-11-04T10:22:48.000Z (9 days ago)
- Last Synced: 2024-11-04T11:26:18.558Z (9 days ago)
- Topics: api-client, nodejs, ocr, ocr-api, sdk
- Language: TypeScript
- Homepage: https://mindee.com
- Size: 8.7 MB
- Stars: 25
- Watchers: 2
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[![License: MIT](https://img.shields.io/github/license/mindee/mindee-api-nodejs)](https://opensource.org/licenses/MIT) [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/mindee/mindee-api-nodejs/test.yml)](https://github.com/mindee/mindee-api-nodejs) [![NPM Version](https://img.shields.io/npm/v/mindee)](https://www.npmjs.com/package/mindee) [![Downloads](https://img.shields.io/npm/dm/mindee)](https://www.npmjs.com/package/mindee)
# Mindee API Helper Library for Node.js
Quickly and easily connect to Mindee's API services using Node.js.## Quick Start
Here's the TL;DR of getting started.First, get an [API Key](https://developers.mindee.com/docs/create-api-key)
Then, install this library:
```shell
npm install mindee
```Finally, Node.js away!
### Loading a File and Parsing It
#### Global Documents
```js
const mindee = require("mindee");
// for TS or modules:
// import * as mindee from "mindee";// Init a new client
const mindeeClient = new mindee.Client({ apiKey: "my-api-key" });// Load a file from disk
const inputSource = mindeeClient.docFromPath("/path/to/the/file.ext");// Parse it on the API of your choice
const apiResponse = mindeeClient.parse(mindee.product.InvoiceV4, inputSource);
```**Note:** Files can also be loaded from:
A URL (`https` only):
```js
const inputSource = mindeeClient.docFromUrl("https://my-url");
```A base64 encoded string:
```js
const inputSource = mindeeClient.docFromBase64(myInputString, "my-file-name")
```A stream:
```js
const inputSource = mindeeClient.docFromStream(myReadableStream, "my-file-name")
```A buffer:
```js
const inputSource = mindeeClient.docFromBuffer(myBuffer, "my-file-name")
```#### Region-Specific Documents
Region-Specific Documents use the following syntax:
```js
const mindee = require("mindee");
// for TS or modules:
// import * as mindee from "mindee";const mindeeClient = new mindee.Client({ apiKey: "my-api-key" });
const inputSource = mindeeClient.docFromPath("/path/to/the/file.ext");
// The IdCardV1 product belongs to mindee.product.fr, not mindee.product itself
const apiResponse = mindeeClient.parse(mindee.product.fr.IdCardV1, inputSource);
```#### Custom Documents (API Builder)
Custom documents will require you to provide their endpoint manually.
```js
const mindee = require("mindee");
// for TS or modules:
// import * as mindee from "mindee";// Init a new client
const mindeeClient = new mindee.Client({
apiKey: "my-api-key"
});// Load a file from disk
const inputSource = mindeeClient.docFromPath("/path/to/the/file.ext");// Create a custom endpoint for your product
const customEndpoint = mindeeClient.createEndpoint(
"my-endpoint",
"my-account",
"my-version" // will default to 1 if not provided
);// Parse it
const apiResponse = mindeeClient
.parse(
mindee.product.CustomV1,
inputSource,
{
endpoint: customEndpoint
}
);
```### Handling the Return
```js
// Handle the response Promise
apiResponse.then((resp) => {
// print a string summary
console.log(resp.document.toString());// individual pages (array)
console.log(res.document.inference.pages);
});
```### Additional Options
Options to pass when sending a file to be parsed.#### Page Options
Allows only sending certain pages in a PDF.In this example we only send the first, penultimate, and last pages:
```js
const apiResponse = mindeeClient.parse(
mindee.product.InvoiceV4,
inputSource,
{
pageOptions: {
pageIndexes: [0, -2, -1],
operation: mindee.PageOptionsOperation.KeepOnly,
onMinPages: 2
}
});
```## Further Reading
Complete details on the working of the library are available in the following guides:* [Node.js Getting Started](https://developers.mindee.com/docs/nodejs-getting-started)
* [Node.js Generated API](https://developers.mindee.com/docs/nodejs-generated-ocr)
* [Node.js Custom OCR (Deprecated)](https://developers.mindee.com/docs/nodejs-api-builder)
* [Node.js Invoice OCR](https://developers.mindee.com/docs/nodejs-invoice-ocr)
* [Node.js International Id OCR](https://developers.mindee.com/docs/nodejs-international-id-ocr)
* [Node.js Receipt OCR](https://developers.mindee.com/docs/nodejs-receipt-ocr)
* [Node.js Resume OCR](https://developers.mindee.com/docs/nodejs-resume-ocr)
* [Node.js Financial Document OCR](https://developers.mindee.com/docs/nodejs-financial-document-ocr)
* [Node.js Passport OCR](https://developers.mindee.com/docs/nodejs-passport-ocr)
* [Node.js Proof of Address OCR](https://developers.mindee.com/docs/nodejs-proof-of-address-ocr)
* [Node.js EU License Plate OCR](https://developers.mindee.com/docs/nodejs-eu-license-plate-ocr)
* [Node.js EU Driver License OCR](https://developers.mindee.com/docs/nodejs-eu-driver-license-ocr)
* [Node.js FR Bank Account Detail OCR](https://developers.mindee.com/docs/nodejs-fr-bank-account-details-ocr)
* [Node.js FR Carte Vitale OCR](https://developers.mindee.com/docs/nodejs-fr-carte-vitale-ocr)
* [Node.js FR ID Card OCR](https://developers.mindee.com/docs/nodejs-fr-carte-nationale-didentite-ocr)
* [Node.js US Bank Check OCR](https://developers.mindee.com/docs/nodejs-us-bank-check-ocr)
* [Node.js US W9 OCR](https://developers.mindee.com/docs/nodejs-us-w9-ocr)
* [Node.js US Driver License OCR](https://developers.mindee.com/docs/nodejs-us-driver-license-ocr)
* [Node.js Barcode Reader API](https://developers.mindee.com/docs/nodejs-barcode-reader-ocr)
* [Node.js Cropper API](https://developers.mindee.com/docs/nodejs-cropper-ocr)
* [Node.js Invoice Splitter API](https://developers.mindee.com/docs/nodejs-invoice-splitter-ocr)
* [Node.js Multi Receipts Detector API](https://developers.mindee.com/docs/nodejs-multi-receipts-detector-ocr)You can also take a look at the **[Reference Documentation](https://mindee.github.io/mindee-api-nodejs/)**.
## License
Copyright © MindeeAvailable as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## Questions?
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)