# linkpeek

> Fast, safe link preview library and URL unfurler for TypeScript. Extracts Open Graph, Twitter Card and JSON-LD metadata on Node.js, Bun, Deno and the edge.

linkpeek turns a URL into its title, description, image and favicon from Open Graph, Twitter Card and JSON-LD. It reads only the page head, blocks private addresses by default, and runs on Node.js 22.12+, Bun, Deno and fetch-compatible edge runtimes. One runtime dependency.

```bash
npm install linkpeek
```

```ts
import { preview } from "linkpeek";

const card = await preview("https://example.com/article");
if (card.statusCode < 400) {
  console.log(card.title, card.description, card.image);
}
```

## Performance

Measured on November 15, 2026 against five other link preview packages.

- 500 kB page, vs the next-fastest package: **4.0× faster**
- Install size, vs the next-smallest package: **2.4× smaller**
- Runtime dependencies: **1**

**500 kB page with a normal head.** Median milliseconds per end-to-end preview. Shorter is faster.

| Package | Median |
| --- | ---: |
| **linkpeek** 3.0.0 | 2.76 ms |
| unfurl.js 6.4.0 | 11.0 ms |
| link-preview-js 6.0.0 | 48.6 ms |
| url-metadata 6.3.1 | 49.5 ms |
| metascraper 5.58.6 | 62.6 ms |
| open-graph-scraper 6.13.0 | 377 ms |

## Documentation

- [API reference: preview() and parseHTML()](https://linkpeek.js.org/api/): Reference for linkpeek's preview() and parseHTML(): presets, every option, the typed result fields, HTTP error handling and the error codes.
- [Link preview library benchmarks](https://linkpeek.js.org/benchmarks/): Reproducible link preview benchmarks: linkpeek against five packages on large and small pages, install size, and how much of each page is read.
- [Get the Open Graph image, title and favicon from a URL](https://linkpeek.js.org/guides/get-og-image-from-url/): Get the og:image, title, description and favicon of any URL in Node.js or TypeScript with one preview() call, including fallbacks and relative URLs.
- [link-preview-js alternative for TypeScript](https://linkpeek.js.org/guides/link-preview-js-alternative/): Compare linkpeek with link-preview-js: speed on large pages, install size, runtimes, SSRF defaults, and migrating getLinkPreview() to preview().
- [Link preview libraries for Node.js compared](https://linkpeek.js.org/guides/link-preview-library-comparison/): Compare linkpeek with link-preview-js, open-graph-scraper, metascraper, unfurl.js, and url-metadata by use case, API shape, security, and footprint.
- [metascraper alternative for TypeScript](https://linkpeek.js.org/guides/metascraper-alternative/): Compare linkpeek with metascraper: a focused preview library against a rule framework. Speed, install size, fetching, and how to migrate.
- [Open Graph parser and scraper for Node.js and TypeScript](https://linkpeek.js.org/guides/open-graph-parser/): Parse or fetch Open Graph, Twitter Card, JSON-LD, favicon and canonical metadata in Node.js and TypeScript with parseHTML() and preview().
- [open-graph-scraper alternative for TypeScript](https://linkpeek.js.org/guides/open-graph-scraper-alternative/): Compare linkpeek with open-graph-scraper: speed on large pages, install size, edge runtime support, SSRF defaults, and how to migrate ogs() to preview().
- [Troubleshoot link previews and missing metadata](https://linkpeek.js.org/guides/troubleshooting/): Fix missing Open Graph metadata, HTTP errors, JavaScript-only pages, timeouts, and blocked URLs in server-side link previews.
- [unfurl.js alternative for TypeScript](https://linkpeek.js.org/guides/unfurl-js-alternative/): Compare linkpeek with unfurl.js, which is archived upstream: speed, install size, oEmbed, edge runtimes, and migrating unfurl() to preview().
- [url-metadata alternative for TypeScript](https://linkpeek.js.org/guides/url-metadata-alternative/): Compare linkpeek with url-metadata: large-page speed, install size, byte limits, edge runtimes, SSRF defaults, and migrating urlMetadata().
- [Link metadata tool for AI agents](https://linkpeek.js.org/integrations/ai-agents/): Create a link metadata tool for AI agents with TypeScript. Includes URL fetching, caching, and handling untrusted page content.
- [Link previews in Cloudflare Workers](https://linkpeek.js.org/integrations/cloudflare-workers/): Extract Open Graph and URL metadata in a Cloudflare Worker with linkpeek: fetch-native, no Node APIs, with cache headers and safe defaults.
- [Editor.js link tool backend with linkpeek](https://linkpeek.js.org/integrations/editorjs/): A backend endpoint for the Editor.js link tool (@editorjs/link): fetch the pasted URL's title, description and image safely with linkpeek.
- [Link previews in Next.js](https://linkpeek.js.org/integrations/nextjs/): Build a server-side link preview endpoint with linkpeek and the Next.js App Router: a Route Handler, input checks, caching and safe rendering.
- [Link preview API with Node.js and Express](https://linkpeek.js.org/integrations/node-express/): Build a link preview and URL metadata API with linkpeek, Node.js and Express: input validation, caching, error handling and safe defaults.
- [React link preview card](https://linkpeek.js.org/integrations/react/): Build an accessible React link preview card: a server endpoint calls linkpeek, and the card renders title, description, image and host with fallbacks.
- [Quick start: link previews in TypeScript](https://linkpeek.js.org/quick-start/): Install linkpeek, fetch a URL with preview(), and render Open Graph, Twitter Card, and JSON-LD metadata as a link preview card.
- [Link preview security and SSRF limits](https://linkpeek.js.org/security/): Understand linkpeek's redirect validation, private-address blocking, credential handling, and DNS-rebinding limits.
