> ## Documentation Index
> Fetch the complete documentation index at: https://docs.markpdf.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Your first conversion with Bun's SDK in less than 15 lines.

# Quickstart

## Convert a local file

`convertFile` receives a route and uses `Bun.file(path)` internally to stream the content directly to the request body — PDF is never loaded in its entirety in `Buffer` JS.

```ts theme={null}
import { MarkpdfClient } from "@markpdf/bun";

const client = new MarkpdfClient({ apiKey: "YOUR_API_KEY" });

const markdown = await client.convertFile("./report.pdf", { mode: "fast" });
console.log(markdown);
```

## Convert bytes already loaded into memory

If you already have PDF as `Uint8Array`/`ArrayBuffer` (for example, received in `Request`), use `convertBytes`:

```ts theme={null}
const bytes = await Bun.file("./report.pdf").arrayBuffer();
const markdown = await client.convertBytes(bytes, "report.pdf", { mode: "fast" });
```

## Convert from URL

```ts theme={null}
const markdown = await client.convertFromUrl(
  "https://bucket.example.com/report.pdf?sig=...",
  "report.pdf",
  { mode: "fast" }
);
```

## Request metadata in addition to Markdown

```ts theme={null}
const result = await client.convertFile("./report.pdf", {
  responseFormat: "json",
});

console.log(result.markdown);
console.log(result.timings.totalRequestMs);
```

With `responseFormat: "json"` the SDK returns a typed `ConversionResult` object instead of `string`. See [Reference](/docs/sdks/bun/reference).

## Siguiente paso

* [Full customer reference](/docs/sdks/bun/reference)
* [Streaming and asynchronous jobs (202)](/docs/sdks/bun/streaming-and-async)
* [Error Handling](/docs/sdks/bun/error-handling)
