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

oxpdf

v0.1.3

Published

TypeScript/JavaScript SDK for the 0xPdf PDF-to-JSON API

Downloads

43

Readme

oxpdf

TypeScript/JavaScript SDK for the 0xPdf PDF-to-JSON API.

Works in Node.js 18+, Bun, Deno, and the browser — zero dependencies, uses native fetch.

Installation

npm install oxpdf

Quick Start

import { OxPDFClient } from "oxpdf";

const client = new OxPDFClient({ apiKey: "your_api_key" });

// Parse with a built-in template
const result = await client.parse(pdfBuffer, "invoice.pdf", {
  schemaTemplate: "invoice",
});
console.log(result.data);

// Parse from a file path (Node.js only)
const result2 = await client.parseFile("./invoice.pdf", {
  schemaTemplate: "invoice",
});

// Queue async processing and wait for completion
const queued = await client.upload(pdfBuffer, "invoice.pdf", {
  schemaId: "your_schema_id",
});
const finalStatus = await client.waitForJob(queued.job_id, {
  intervalMs: 2000,
  timeoutMs: 180000,
});
console.log(finalStatus.status);

// Streaming parse with real-time progress
for await (const event of client.parseFileStream("./large.pdf", {
  schemaTemplate: "invoice",
})) {
  if (event.event === "page") console.log(event.data.message);
  if (event.event === "complete") console.log("Done!", event.data);
}

Browser Usage

const input = document.querySelector<HTMLInputElement>("#pdf-upload")!;
input.addEventListener("change", async () => {
  const file = input.files![0];
  const result = await client.parse(file, file.name, {
    schemaTemplate: "invoice",
  });
  console.log(result.data);
});

Error Handling

import { OxPDFClient, OxPDFError } from "oxpdf";

try {
  const result = await client.parseFile("doc.pdf", {
    schemaTemplate: "invoice",
  });
} catch (e) {
  if (e instanceof OxPDFError) {
    console.error(`API error: ${e.message} (status: ${e.statusCode})`);
  }
}

Full API Reference

Constructor

new OxPDFClient({ apiKey, baseUrl?, timeout?, retry? })

| Option | Type | Default | Description | | --------- | -------- | ------------------------------------ | -------------------- | | apiKey | string | — | Your 0xPdf API key | | baseUrl | string | https://api.0xpdf.io/api/v1 | API base URL | | timeout | number | 120000 | Request timeout (ms) | | retry | object | { maxRetries: 2, initialDelayMs: 500, backoffMultiplier: 2 } | Retry/backoff config |

PDF Parsing

| Method | Description | |---|---| | parse(file, filename, options?) | Sync parse from Buffer/Blob/File | | parseFile(filePath, options?) | Sync parse from file path (Node.js) | | parseStream(file, filename, options?) | Streaming SSE parse (async generator) | | parseFileStream(filePath, options?) | Streaming parse from file (Node.js) | | validate(file, filename, options?) | Dry-run validation |

Async Jobs

| Method | Description | |---|---| | upload(file, filename, options?) | Queue PDF for background processing | | jobStatus(jobId) | Poll async job status | | waitForJob(jobId, options?) | Poll until completed/failed (with timeout) |

Image Extraction

| Method | Description | |---|---| | extractImages(file, filename, options?) | Extract images from a PDF | | listImages(limit?, offset?) | List extracted images | | getImageUrl(imageId, expirationSeconds?) | Get/refresh presigned URL | | deleteImage(imageId) | Delete a specific image | | deleteAllImages() | Delete all images |

File Management

| Method | Description | |---|---| | listFiles() | List uploaded PDFs | | getFile(pdfId) | Get PDF metadata + download URL | | deleteFile(pdfId) | Delete an uploaded PDF |

Schema CRUD

| Method | Description | |---|---| | listSchemas() | List saved schemas | | getSchema(schemaId) | Get schema with full definition | | createSchema(options) | Create a new schema | | updateSchema(schemaId, options) | Update existing schema | | deleteSchema(schemaId) | Delete a schema | | setDefaultSchema(schemaId) | Set as default | | generateSchema(options) | AI-generate a schema |

Templates

| Method | Description | |---|---| | listTemplates() | Parse templates (invoice, receipt, etc.) | | listSchemaTemplates() | Schema editor templates | | getSchemaTemplate(templateId) | Get template with full schema |

Analytics & Pricing

| Method | Description | |---|---| | getAnalytics() | Usage analytics | | submitFeedback(feedback) | Submit feedback | | getPricing(billingCycle?) | Get pricing tiers | | getCurrentTier() | Current subscription & quota |

Parse Options

| Option | Type | Description | | ---------------- | ---------------------- | -------------------------------------- | | schema | Record<string, any> | Custom JSON schema | | schemaTemplate | string | Pre-built template name | | schemaId | string | Saved schema ID | | useOcr | boolean | Enable OCR (default: false) | | ocrEngine | string | "surya" or "groq_vision" | | pages | number[] | Specific pages to parse |