> ## 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 SDK Node.js/TypeScript in less than 15 lines.

# Quickstart

## Convert a local file (Node.js)

```ts theme={null}
import { readFile } from "node:fs/promises";
import { MarkpdfClient } from "@markpdf/sdk";

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

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

## Convert from URL

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

## Convert a `File`/`Blob` (browser or edge, via your own backend)

```ts theme={null}
export async function handleUpload(file: File) {
  const markdown = await client.convertFile(file, { filename: file.name, mode: "fast" });
  return markdown;
}
```

`convertFile` acepta `Buffer`, `Uint8Array`, `Blob` o `File` indistintamente.

## Request metadata in addition to Markdown

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

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

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

## Siguiente paso

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