Simple node module to retrieves a user avatar given an email or a user name from Google, gravatar or a default image.
Changelog: Change all the changes to this project here
How to use it?
var avatarMe = require('avatar-me')
avatarMe.fetchAvatar('jorge@ferreiro.me', 'jorge', (err, avatar) => {
if (err) console.log(err)
console.log(avatar)
})
Configuration? Yes, please!
Basic configuration
var avatarMe = require('avatar-me')
avatarMe.configure({
defaultAvatar: 'mySuperAwesomeDefaultAvatar.png',
defaultAvatarPath: 'http://my/super/awesome/path/to/default/images/'
})
avatarMe.fetchAvatar('jorge@ferreiro.me', 'jorge', (err, avatar) => {
if (err) console.log(err)
console.log(avatar)
})
### Cache configuration using Redis. No more extra api calls!
In 0.1.0 we have introduced support to cache results with Redis!
Just add redis to the avatar me config and it will create a new redis client.
var avatarMe = require('./index.js')
avatarMe.configure({
defaultAvatar: 'mySuperAwesomeDefaultAvatar.png',
defaultAvatarPath: 'http://my/super/awesome/path/to/default/images/',
cache: {
host: '127.0.0.1',
port: '6379'
},
shouldFetchGmail: false,
shouldFetchGravatar: false
})
avatarMe.fetchAvatar('jorge@ferreiro.me', 'jorge', (err, avatar) => {
console.log(err)
console.log(avatar)
})
Contribute!