git clone [email protected]:DTrejo/favicon.js.git cd favicon.js npm install
$ favicon google.com amazon.com github.com http://google.com/favicon.ico http://amazon.com/favicon.ico http://github.com/favicon.ico
var favicon = require('favicon'); var icon = favicon.get('dtrejo.com', function(err, url){ console.log(url); });
Note that at the moment it will return http://dtrejo.com/favicon.png if it cannot find a given site’s favicon in any of the normal places.
I should probably change this.
favicon.js is a Javascript/node.js port of braveicon by bmelton.
Fetches a site’s favicon URL. Respects link rel="" declarations— bmelton
most importantly, per W3C spec, however, it favors ‘shortcut icon’
over /favicon.ico, as many software packages explicitly declare
via shortcut icon, and W3C snubs /favicon.ico, generally speaking