0.2.0 • Published 9 years ago

octocat-images v0.2.0

Weekly downloads
7
License
MIT
Repository
github
Last release
9 years ago

octocat-images

npm version Build Status

:octocat: Get or save octocat image from octodex.gituhb.com

droctocat

Install

With npm do:

npm install octocat-images

Example Usage

'use strict';
let OctoCatCrawler = require('octocat-images');
let crawler = new OctoCatCrawler();

// List all octocat images
crawler.list((err, octocats) => {
  if (err) throw err;
  for (let octocat of octocats) {
    console.log(octocat.number, octocat.name, octocat.url);
    octocat.save('images');
  }
});

// Give you a random choice of octocat image
crawler.choice((err, octocat) => {
  console.log(octocat.number, octocat.name, octocat.url);
  octocat.save('images');
});

APIs

crawler.list(cb)

Return an array include all octocat instances.

cb(err, octocats) fires with the error or the octocats instances will be returned.

crawler.choice(cb)

Return a random choice of octocat instance.

cb(err, octocats) fires with the error or the octocats instance will be returned.

octocat.save(dir)

Save the images. The images directory dir is required.

license

MIT

0.2.0

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago