page-icon-finder
v1.1.2
Published
Find the best icon for a web page
Downloads
5
Readme
Page Icon
A library to find the highest resolution website logo for a given url.
This a TypeScript implementation of the original page-icon library.
Installation
yarn global add page-icon-finder
or
yarn add page-icon-finder
Usage
CLI
USAGE
$ page-icon-finder <URL> [EXTENSION]
ARGUMENTS
URL URL to search the icon in
EXTENSION (.jpg|.png|.ico) Filetype to search for
OPTIONS
-b, --buffer Only output the whole Buffer of the icon
EXAMPLES
$ pageicon <url> [extension]
$ pageicon https://www.wikipedia.com
$ pageicon https://www.wikipedia.com .png
Programmatic
import pageIcon from 'page-icon';
const URL = 'https://www.facebook.com/';
try {
const icon = await pageIcon(URL);
console.log('ICON: ', icon);
} catch (err) {
console.error(err);
}
Option
Optionally the function takes one of the following extensions .jpg
, .png
or .ico
.
Example Icon Object
{
source: 'https://www.facebook.com/images/fb_icon_325x325.png',
name: 'www.facebook.com',
data: <Buffer 89 50 4e ... >,
size: 1919,
ext: '.png',
mime: 'image/png'
}
License
Original author: Goh Jia Hao
Forked from https://github.com/jiahaog/page-icon