LiteRT/Gravatar
A toolkits for using gravatar.
Requirement
- TypeScript v2.6.1 (or newer)
Installation
Install by NPM:
npm i @litert/gravatar --save
Usage
Here is an example for Node.js: (in TypeScript)
import * as gravatar from "@litert/gravatar";
import * as crypto from "crypto";
// before using it, please inject a MD5 function, e.g.
gravatar.setMD5Function(function(email: string): string {
let hasher = crypto.createHash("md5");
hasher.update(email);
return hasher.digest().toString("hex");
});
console.log(gravatar.getAvatarUrl("i.am.x.fenying@gmail.com"));
License
This library is published under MIT license.