Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Find the URLs of the site's icons
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
.npmignore
LICENSE-MIT
README.md
grunt.js
package.json

README.md

Icons - Find the URLs of a web app's icons

Install

npm install icons

Simple to use

Icons is designed to find the URLs of a web app's icons.

Current version is able to discover following icons:

It supports redirection by the Refresh HTTP Header or its markup equivalent, the latter being used at the time of writing by Twitter. It also supports redirection to the URL provided by the HTML link element with @rel="alternate" and @media="handheld", being used at the time of writing by NYTimes.

var icons = require('icons');
icons.discover("https://github.com", function(err, icons) {
    console.log(err ? ("ERROR " + err) : icons);
});

prints

[{
    name: ['iPhone', 'iPod Touch', 'Android', 'BlackBerry'],
    pixels: [0, 57],
    urls: ['http://www.github.com/apple-touch-icon-114.png'],
    location: ['link']
}, {
    name: 'iPad',
    pixels: [72],
    urls: ['http://www.github.com/apple-touch-icon-144.png'],
    location: ['link']
}, {
    name: 'iPhone Retina',
    pixels: [114],
    urls: ['http://www.github.com/apple-touch-icon-114.png'],
    location: ['link']
}, {
    name: 'iPad Retina',
    pixels: [144],
    urls: ['http://www.github.com/apple-touch-icon-144.png'],
    location: ['link']
}]

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

License

Copyright (c) 2012 Pedro Faustino
Licensed under the MIT license.

Something went wrong with that request. Please try again.