npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

link-view

v1.0.3

Published

A Node.js package to generate link previews from URLs

Downloads

11

Readme

Link Preview

A powerful Node.js package that generates rich link previews by extracting comprehensive metadata from any URL. Perfect for social media apps, messaging platforms, and content aggregators.

✨ Features

  • 🚀 High Performance - Optimized for speed with intelligent caching
  • 🔍 Deep Extraction - Pulls titles, descriptions, images, favicons, and more
  • 💪 Robust Handling - Works reliably with e-commerce sites, blogs, and media platforms
  • ⚡ Async Support - Modern Promise-based API
  • 🛡️ Error Resilience - Graceful fallbacks and comprehensive error handling
  • 🧩 Easily Extensible - Customize extraction rules for specific sites

📦 Installation

npm install link-view

🚀 Quick Start

const { generateLinkPreview } = require('link-view');

// Basic usage
generateLinkPreview('https://www.example.com')
  .then(preview => console.log(preview))
  .catch(error => console.error('Error:', error.message));

// With async/await
async function getPreview() {
  try {
    const preview = await generateLinkPreview('https://www.example.com');
    console.log(preview);
  } catch (error) {
    console.error('Error:', error.message);
  }
}

📋 Response Format

The package returns a promise that resolves to an object with the following properties:

{
  url: 'https://example.com',                      // The canonical URL
  title: 'Example Domain',                         // Page title
  description: 'This domain is for illustrative...', // Page description
  image: 'https://example.com/image.jpg',          // Primary image URL
  favicon: 'https://example.com/favicon.ico',      // Favicon URL
  domain: 'example.com',                          // Domain name (without www)
  author: 'Example Author'                         // Content author (if available)

The package includes special handling for popular platforms:

// E-commerce sites
generateLinkPreview('https://www.amazon.com/product/...')
  .then(preview => console.log(preview));

// News sites
generateLinkPreview('https://www.nytimes.com/2023/...')
  .then(preview => console.log(preview));

🛠️ Examples

Integration with Express.js

const express = require('express');
const { generateLinkPreview } = require('link-view');

const app = express();
app.use(express.json());

app.post('/api/preview', async (req, res) => {
  try {
    const { url } = req.body;
    if (!url) {
      return res.status(400).json({ error: 'URL is required' });
    }
    
    const preview = await generateLinkPreview(url);
    res.json(preview);
  } catch (error) {
    res.status(500).json({ error: error.message });
  }
});

app.listen(3000, () => {
  console.log('Server running on port 3000');
});

📊 Performance

The package is optimized for performance:

  • Intelligent caching reduces repeat requests
  • Resource filtering minimizes bandwidth usage
  • Parallel processing for faster extraction
  • Memory-efficient operations for large scale applications

Made with ❤️ by [Shajmil VJ]