A starter template for deploying LiteParse on Cloudflare Workers to parse PDFs at the edge using WebAssembly.
This Worker runs LiteParse's Rust/WASM parser directly on Cloudflare's edge runtime, letting you extract text from PDFs without managing servers or containers.
- Node.js 18+
- Wrangler CLI logged in (
npx wrangler login)
# Install dependencies
npm install
# Start local dev server
npm run devSend a PDF as the request body:
curl -X POST --data-binary @document.pdf http://localhost:8787Response:
{
"text": "Extracted text content...",
"pages": 12
}npm run deploy| File | Description |
|---|---|
src/index.ts |
Worker entrypoint — accepts PDF bytes, runs WASM parser, returns JSON |
liteparse_wasm_bg.wasm |
Compiled LiteParse WebAssembly module |
wrangler.jsonc |
Cloudflare Workers configuration with CompiledWasm rule |
- The
.wasmfile is bundled via Wrangler'sCompiledWasmrule. initSync()initializes the WASM module on the first request.LiteParseparses the PDF bytes and returns structured text.
MIT