Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Parser link metadata with image base64-encoding feature

License

Notifications You must be signed in to change notification settings

viz-cx/link-metadata-parser

Repository files navigation

Link metadata parser

This parser based on url-metadata module. Also used chardet and iconv-lite for encoding characters, sharp for image conversion, nodemon for local development.

Usage

Either through cloning with git or by using npm (the recommended way):

npm install --save link-metadata-parser

and use in code:

var linkMetadata = require('link-metadata-parser');

/**
 * Also you can pass all options from 
 * https://github.com/LevelNewsOrg/url-metadata/#options
 */
var options = {
    encodeImage: false,
    maxImageWidth: 0
};

linkMetadata(link, options).then(
    (meta) => console.log(meta),
    (err) => console.log(err)
);

Deploy

Repository already contains server example:

npm run server

and it can be running inside Docker:

docker build -t metadata:latest -f ./example/Dockerfile .
docker run -d -p 8080:8080 --name link-metadata-parser metadata:latest

Development

npm run develop