Skip to main content

Referencia

MarkpdfClient

string
required
Your API key. If you don’t pass it, the client reads Bun.env.MARKPDF_API_KEY.
string
default:"https://api.markpdf.tech"
URL base of API.
number
default:"300000"
Timeout per request in milliseconds.
number
default:"2"
Automatic retries with exponential backoff in 429 and 5xx.
boolean
default:"true"
If the server responds 202 (backends saturated), it automatically polls GET /jobs/{id}. It can be overwritten by call.

Methods

They all accept the same options as the query params of API, in camelCase.

convertFile

Opens path with Bun.file(path) and passes it as body of POST /convert/raw — Bun streams the file directly to the socket, without going through an intermediate Buffer. The filename is inferred from the base name of path.

convertBytes

Same as convertFile, but for data already loaded into memory (for example, the body of an incoming Request).

convertFromUrl

Llama a POST /convert/from-url.

convertStream

Async generator that emits Markdown fragments as they arrive from POST /convert/stream, reading the file with Bun.file(path). See Streaming and async.

pdfIndex

Call POST /pdf/index. Returns the typed spine.

getJob

Consulta manualmente GET /jobs/{id}.

waitForJob

Polls GET /jobs/{id} until the status is completed or failed, or until timeoutMs is exhausted. Used internally by autoPoll: true.

Tipos

ConversionResult

PdfSpine

JobStatus

All types are exported from @markpdf/bun: