1.0.1 • Published 6 years ago

simple-unfurl v1.0.1

Weekly downloads
9
License
MIT
Repository
github
Last release
6 years ago

What is it ?

When you share a link on Fb, Twitter or Whatsapp, you must have noticed that a stylish preview is generated. This is meant to provide good UX to the user and because everyone is providing this, user expects the same from your application. Don't let your users down, follow the trend, unfurl those links easily.

npm version npm Github file size Open Source Love PRs Welcome

How To Use

const unfurl = require('simple-unfurl');

const url = 'https://medium.freecodecamp.org/avoiding-the-async-await-hell-c77a0fb71c4c';
const pageData = await unfurl(url);

// Output
{
  url: 'https://medium.freecodecamp.org/avoiding-the-async-await-hell-c77a0fb71c4c',
  title: 'How to escape async/await hell - freeCodeCamp',
  description: "async/await freed us from callback hell, but people have started abusing it - leading to the birth of async/await hell. In this article, I will try to explain what async/await hell is, and I'll also.",
  imageUrl: 'https://cdn-images-1.medium.com/max/1200/1*_3nDjjPTWn4ohLt96IcwCA.png'
}

You can check the demo for a fully working example

API

unfurl(url, mapping)
Argument NameTypeDescriptionRequiredDefault
urlStringlink to generate preview fortrueN/A
mappingObjectmap object key to meta tag namefalse{ title: 'title', description: 'description', imageUrl: 'twitter:image:src' }