8000 GitHub - btwld/docling-sdk: A TypeScript SDK for Docling - Bridge between the Python Docling ecosystem and JavaScript/TypeScript. · GitHub
[go: up one dir, main page]

Skip to content

About

A TypeScript SDK for Docling - Bridge between the Python Docling ecosystem and JavaScript/TypeScript.

Topics

Resources

Contributing

Stars

37 stars

Watchers

0 watching

Forks

Repository files navigation

Docling SDK

TypeScript clients for Docling.

Core concepts

  • Convert documents to Markdown, HTML, text and structured JSON.
  • API: Docling Serve performs conversion, chunking and S3 work; the SDK sends requests and tracks tasks.
  • CLI: Node runs an installed Python Docling command for local conversion and batch work.
  • Web OCR: a browser worker runs a downloaded model on images; PDF pages first render to images with optional unpdf.
  • Clients share conversion methods but have different capabilities; choose by where processing should run. Web does not parse Office/HTML inputs or support file-output methods.
  • Portable binary input is Uint8Array; filesystem and stream behavior depend on the method and runtime.
  • Ordinary conversion returns a document response; safeConvert wraps rejection. File-output methods have a separate success/failure contract.
  • The package publishes ESM. Browser API use starts with createAPIClient from docling-sdk/browser; local OCR starts with createWebClient from docling-sdk/web.

Install

npm install docling-sdk

API mode needs a running Docling Serve instance. CLI mode needs Python Docling installed locally and Node.js >=18. Node API usage also requires Node.js >=18.

For browser OCR, install its optional peers:

npm install @huggingface/transformers onnxruntime-web
# Also needed for Web PDF rendering:
npm install unpdf

First API conversion (Node)

import { readFile } from "node:fs/promises";
import { createAPIClient } from "docling-sdk";

const client = createAPIClient("http://localhost:5001");
const result = await client.convert(await readFile("input.pdf"), "input.pdf", {
  to_formats: ["md"],
});
console.log(result.document.md_content);

Next steps

BSD-3-Clause license.

About

A TypeScript SDK for Docling - Bridge between the Python Docling ecosystem and JavaScript/TypeScript.

Topics

Resources

Contributing

Stars

37 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0