Skip to content

Latest commit

 

History

History
76 lines (54 loc) · 2.16 KB

README.md

File metadata and controls

76 lines (54 loc) · 2.16 KB

Avatar me logo

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('[email protected]', '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('[email protected]', '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 for caching API calls using Redis!

If you wanna use this feature, 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('[email protected]', 'jorge', (err, avatar) => {
	console.log(err)
	console.log(avatar)
})

Contribute!

💬 Create a new Pull Request

My social networks

If you have some doubts or want to stay in touch I'll be happy to help you out or collaborate on new projects. You can reach me here:

Also you can find me on: