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

facturahub-ocr

v0.1.0

Published

OCR de tickets y recibos por API: foto → JSON con comercio, importe, IVA, líneas y deducibilidad. Cliente TypeScript de la API de FacturaHub. Receipt OCR for Spain.

Readme

facturahub-ocr

Parte del ecosistema FacturaHub — facturación en España, Verifactu, IVA, Modelo 303 y automatización fiscal con IA.

OCR de tickets y recibos por API. Envía una imagen y recibe JSON estructurado: comercio, importe, IVA, fecha, líneas del ticket y deducibilidad. TypeScript · 0 dependencias · MIT.

Receipt & invoice OCR for Spain — send an image, get vendor, amount, VAT, line items and deductibility as JSON.

Instalación

npm i facturahub-ocr

Necesitas una API key gratuita: créala en FacturaHub → Ajustes.

Uso

import { FacturaHubOCR } from 'facturahub-ocr';
import { readFileSync } from 'node:fs';

const ocr = new FacturaHubOCR({ apiKey: process.env.FACTURAHUB_API_KEY! });

// Desde bytes (Node 18+, fetch global)
const bytes = readFileSync('ticket.jpg');
const result = await ocr.scan({ bytes, mediaType: 'image/jpeg' });

console.log(result.vendor);   // "GAMMA"
console.log(result.amount);   // 51.93
console.log(result.currency); // "EUR"
console.log(result.items);    // [{ name, lineTotal, deductible, deductibleReason }, ...]

También acepta un data URL directamente:

await ocr.scan('data:image/jpeg;base64,/9j/4AAQ...');

Respuesta

{
  "vendor": "GAMMA",
  "amount": 51.93,
  "currency": "EUR",
  "date": "2026-06-20",
  "taxRate": 21,
  "confidence": 92,
  "items": [
    { "name": "Ventilador", "lineTotal": 49.99, "category": "equipment",
      "deductible": true, "deductibleReason": "Equipo de oficina" },
    { "name": "Coca-Cola Zero", "lineTotal": 1.79, "category": "meals",
      "deductible": false, "deductibleReason": "Consumo personal" }
  ]
}

API

| Símbolo | Qué hace | |---|---| | new FacturaHubOCR({ apiKey, baseUrl?, fetch? }) | Crea el cliente. apiKey se envía como x-api-key. | | ocr.scan(input) | Escanea un ticket. input = data URL, Uint8Array/ArrayBuffer, o { bytes, mediaType }. Devuelve ReceiptScan. | | toDataUrl(bytes, mediaType?) | Convierte bytes a data URL base64. | | FacturaHubError | Error con status (HTTP) y message (de la API). |

Tipos ReceiptScan y ReceiptItem exportados.

Por qué existe

Teclear tickets a mano es la forma más rápida de perder deducciones de IVA. Esta librería conecta con el motor de OCR con IA de visión de FacturaHub: le mandas la foto del ticket y te devuelve el comercio, el importe, el IVA soportado y, línea a línea, qué es deducible y qué no según las reglas fiscales de tu país — sin entrenar modelos, sin plantillas y sin montar un pipeline de OCR con librerías como Tesseract.

¿Prefieres no escribir código? Manda una foto del ticket por WhatsApp y FacturaHub lo registra solo. Pruébalo gratis.


Hecho por FacturaHub — facturación con IA para autónomos en España: emite Verifactu, lleva tu IVA y Modelo 303 y factura por WhatsApp. Gratis.

Ecosistema FacturaHub

Temas: OCR · OCR tickets · escanear recibos · receipt OCR · gastos deducibles · IVA · Modelo 303 · AEAT · Autónomos · IA · España