linkpeek vs open-graph-scraper
Compare linkpeek with open-graph-scraper: speed on large pages, install size, edge runtime support, SSRF defaults, and how to migrate ogs() to preview().
open-graph-scraper is a broad Open Graph and Twitter Card scraper for Node.js with many options. linkpeek does less on purpose: it reads the page head, returns one typed preview-card result and runs on any runtime with fetch.
Measured side by side
| Metric | linkpeek 3.0.0 | open-graph-scraper 6.13.0 |
|---|---|---|
| 500 kB page, median | 2.76 ms | 377 ms |
| Small pages, mean of medians | 1.25 ms | 1.94 ms |
| Clean install size | 1.3 MB | 11.1 MB |
| Packages installed | 7 | 27 |
open-graph-scraper 6.13 only fetches public addresses, so it cannot reach a local benchmark server. Its numbers are native fetch plus ogs({ html }). See the benchmarks for the method and every package.
Choose open-graph-scraper when
- You need its breadth of scraped fields and options on Node.js.
- You want resolved-address checks on Node.js built in: since 6.13 it only requests destinations whose resolved IP addresses are public. linkpeek checks DNS answers on every hop only when you pass
resolveHost, and does not pin the connection. - You already own the fetch and only need parsing: its maintainers point edge and parse-only users to
open-graph-scraper-lite.
Choose linkpeek when
- You run on Cloudflare Workers, Vercel Edge, Deno or Bun and want fetching, redirect checks and byte limits included.
- Your users paste links to large pages. linkpeek stops reading after
</head>, which is where the gap in the table above comes from. - Install size matters: 7 installed packages instead of 27.
- You want one flat, typed result with
nullfor missing fields instead of arrays of candidates.
Migrate ogs() to preview()
// open-graph-scraper
import ogs from "open-graph-scraper";
const { result } = await ogs({ url });
const card = {
title: result.ogTitle,
description: result.ogDescription,
image: result.ogImage?.[0]?.url,
};
// linkpeek
import { preview } from "linkpeek";
const card = await preview(url);
// card.title, card.description, card.imagelinkpeek falls back from Open Graph to Twitter Card, Dublin Core, the document title and JSON-LD on its own, so one field holds the best value. HTTP error pages resolve with their statusCode; check it before caching. The API reference lists every field and error code.
For a public preview endpoint on Node.js, pair linkpeek with outbound network rules, as the security model explains.
vs link-preview-js
Compare linkpeek with link-preview-js: speed on large pages, install size, runtimes, SSRF defaults, and migrating getLinkPreview() to preview().
vs unfurl.js
Compare linkpeek with unfurl.js, which is archived upstream: speed, install size, oEmbed, edge runtimes, and migrating unfurl() to preview().