glancify
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Glancify

🔍 Glancify is a lightweight TypeScript library that generates a link preview from any public URL by extracting the page's title, description, and Open Graph image.


✨ Features

  • Automatically extracts:
    • <title> tag
    • Meta description tag
    • Open Graph meta tags: og:title, og:description, og:image
  • Returns a clean and simple JSON object
  • Written entirely in TypeScript
  • Designed for server-side usage (Node.js)

📦 Installation

npm install glancify

🚀 Usage

import { glancify } from 'glancify';

(async () => {
  const preview = await glancify('https://example.com');
  console.log(preview);
})();

Example output:

{
  "title": "Example Page Title",
  "description": "This is the meta description of the page.",
  "image": "https://example.com/og-image.jpg"
}

⚠️ Notes

  • Works only with publicly accessible HTTP/HTTPS URLs
  • Ideal for backends, social previews, content scrapers
  • Assumes HTML is UTF-8 encoded

🛠️ Future Enhancements

  • Support for non-UTF-8 charsets
  • Add timeout and retry logic
  • Use a real HTML parser for improved robustness (e.g. cheerio)

Package Sidebar

Install

npm i glancify

Weekly Downloads

21

Version

1.0.1

License

MIT

Unpacked Size

32.2 kB

Total Files

11

Last publish

Collaborators

  • pavlogolovatyy