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

ocr-document-classification

Package Overview
Dependencies
Maintainers
0
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ocr-document-classification - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

11

dist/index.js

@@ -110,12 +110,18 @@ "use strict";

if (file.type === "application/pdf") {
console.log("Processing PDF file...");
text = await extractTextFromPDF(fileContent);
console.log("Text extracted from PDF:", text);
if (!text.trim()) {
console.log("Extracted text is empty, using OCR...");
const blob = new Blob([fileContent], { type: "application/pdf" });
const imageDataUrl = URL.createObjectURL(blob);
text = await ocrImage(imageDataUrl, onProgress);
console.log("Text extracted using OCR:", text);
}
progress = 0.9;
} else {
console.log("Processing image file...");
const imageDataUrl = URL.createObjectURL(file);
text = await ocrImage(imageDataUrl, onProgress);
console.log("Text extracted from image using OCR:", text);
progress = 0.9;

@@ -136,5 +142,10 @@ }

} catch (err) {
console.error("Error processing document:", err);
reject(err);
}
};
reader.onerror = (err) => {
console.error("FileReader error:", err);
reject(err);
};
if (file.type === "application/pdf") {

@@ -141,0 +152,0 @@ reader.readAsArrayBuffer(file);

2

package.json
{
"name": "ocr-document-classification",
"version": "1.1.2",
"version": "1.1.3",
"description": "Document classification using tesseract.js and string-similarity-js.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

Sorry, the diff of this file is not supported yet

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