favicongrab
v1.0.0
Published
A module for grabbing Favicon info from favicongrabber.com API
Downloads
26
Readme
favicongrab
A module for grabbing Favicon for any web site
Install
$ npm install favicongrab --save
or
yarn add favicongrab
Usage
const { grabFavicon } = require('favicongrab');
grabFavicon('https://about.theanubhav.com').then((response)=>{console.log(response)})
Above call returns following response
{ domain: 'about.theanubhav.com',
icons: [ {
src: 'https://about.theanubhav.com/favicon.ico',
type: 'image/x-icon'
} ]
}
API Specification
grabFavicon
returns - Promise
arguments - siteUrl // e.g theanubhav.com
Result Data
Success :
{ domain: 'about.theanubhav.com', icons: [ { src: 'https://about.theanubhav.com/favicon.ico', type: 'image/x-icon' } ] }
Description properties of icon object:
- property src contains an absolute URL for a favicon image and is required and unique;
- property type equals an MIME-type's favicon image;
- property sizes contains size's favicon image and in a simple case has the following format: HEIGHTxWIDTH in pixels.
- Failure :
All error messages have the following format
{
"error": "Unresolved domain name."
}
Reference
favicongrab
uses HTTP API from favicongrabber. Refer service API reference here.
Environment
Currently, favicongrab
is supported for Nodejs Environment only. Please open a issue for browser support, if required.
Contribution
Suggestions and PRs are welcome!
Please create issue or open PR request for contribution.
License
refer LICENSE
file in this repository.