ferreiro / avatar-me

🤖 Simple node module to retrieves a user avatar from Google or Gravatar given an email or a user name

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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('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 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('jorge@ferreiro.me', '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:

About

🤖 Simple node module to retrieves a user avatar from Google or Gravatar given an email or a user name


Languages

Language:JavaScript 100.0%