github-avatar

fetch the github avatar image for a user

npm install github-avatar
5 downloads in the last week
13 downloads in the last month

github-avatar

fetch the github avatar for a user

example

simple

var avatar = require('github-avatar');
var fs =  require('fs');

avatar('substack').pipe(fs.createWriteStream('substack.jpg'));

using leveldb for caching

var avatar = require('github-avatar');
var fs =  require('fs');
var level = require('level');

var img = avatar('substack', { db: level(__dirname + '/cache') });
img.pipe(fs.createWriteStream('substack.jpg'));

methods

var avatar = require('github-avatar')

var img = avatar(username, opts)

Return a readable stream img of jpeg image data for the github user username.

Optionally:

  • opts.db - a leveldb handle to use for caching
  • opts.size - size in pixels of the image to generate
  • opts.maxAge - how long in milliseconds to keep an image in the cache

install

With npm do:

npm install github-avatar

license

MIT

npm loves you