Skip to content

run-llama/liteparse-cloudflare-worker-quickstart

Repository files navigation

LiteParse Cloudflare Worker

A starter template for deploying LiteParse on Cloudflare Workers to parse PDFs at the edge using WebAssembly.

Overview

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.

Prerequisites

Getting Started

# Install dependencies
npm install

# Start local dev server
npm run dev

Usage

Send a PDF as the request body:

curl -X POST --data-binary @document.pdf http://localhost:8787

Response:

{
	"text": "Extracted text content...",
	"pages": 12
}

Deploy

npm run deploy

Project Structure

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

How It Works

  1. The .wasm file is bundled via Wrangler's CompiledWasm rule.
  2. initSync() initializes the WASM module on the first request.
  3. LiteParse parses the PDF bytes and returns structured text.

License

MIT

About

Quickstart on how to deploy LiteParse as a CloudFlare worker

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors