favicongrab

1.0.0 • Public • Published

favicongrab

A module for grabbing Favicon for any web site

Build Status PRs Welcome GitHub issues HitCount

NPM

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

  1. 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.
  1. 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

Open Source Love

refer LICENSE file in this repository.

Readme

Keywords

none

Package Sidebar

Install

npm i favicongrab

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

39.7 kB

Total Files

5

Last publish

Collaborators

  • theanubhav