
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
link-preview-node
Advanced tools
Library to return Image URL, Title and Description of a link for generation of preview of the link
To show preview of a link, we need to know four things: the link itself, image URL, title and description of the link, the module is here to fulfill the need.
const { linkPreview } = require(`link-preview-node`);
linkPreview(`npmjs.com`)
.then(resp => {
console.log(resp);
/* { image: 'https://static.npmjs.com/338e4905a2684ca96e08c7780fc68412.png',
title: 'npm | build amazing things',
description: '',
link: 'http://npmjs.com' } */
// Note that '' is used when value of any detail of the link is not available
}).catch(catchErr => {
console.log(catchErr);
});
// In case you are comfortable with callbacks
const { linkPreviewCallback } = require(`link-preview-node`);
linkPreviewCallback(`npmjs.com`, (err, resp) => {
console.log(err ? err : resp);
});
// An error is returned in first argument of callback and catch block of promise when any invalid URL is supplied to the functions
linkPreview(`fdsafsgd.com`)
.then(ans => {
console.log(ans);
}).catch(catchErr => {
console.log(catchErr);
/* { Error: getaddrinfo ENOTFOUND fdsafsgd.com fdsafsgd.com:80
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)
errno: 'ENOTFOUND',
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'fdsafsgd.com',
host: 'fdsafsgd.com',
port: 80 } */
});
I would like to thank Rahul Taneja (https://irtaneja.com/) for helping me in this module. He can be contacted at connect@irtaneja.com.
If you find any issue in the module, you can report it at https://gitlab.com/nmb94/link-preview/issues.
FAQs
Library to return Image URL, Title and Description of a link for generation of preview of the link
We found that link-preview-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.