gravatar-utils
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.1 • Public • Published

    Gravatar Utils

    npm version

    This npm package makes working with Gravatar a breeze. You don't need to worry about hashing emails, just use this package.

    To import:

    import { getGravatarHash, getGravatarUrl, getGravatarAvatar } from "gravatar-utils";
     
    const userEmail = "xxxxxxxx@xxxxx.xxx";
     
    // This function will generate the hash that gravatar uses to identify users, will return something similar to xxxxxxxxxxxxxxxxxxxxx
    const userHash = getGravatarHash(userEmail);
    // This function will generate the url that is accessible by any fetch library, will return something similar to https://www.gravatar.com/xxxxxxxxxxxxxxxxxxxxx.json
    const gravatarProfileUrl = getGravatarUrl(userEmail);
     
    // Fetch gravatar profile with any library
    const data = await axios({
        url: gravatarProfileUrl 
    });
     
    // To get an image url for an avatar, use the getGravatarAvatar function. You can optionally specify the size in an object in the second function parameter.
    <img src={getGravatarAvatar("xxxxxxxxxx@xxxx.xxx", { size: 1000} )} />

    To install:

    npm install gravatar-utils 
    

    More information on the Gravatar API can be found at https://www.gravatar.com/site/implement/profiles/json/.

    Type definitions are provided!

    Install

    npm i gravatar-utils

    DownloadsWeekly Downloads

    207

    Version

    1.1.1

    License

    ISC

    Unpacked Size

    3.69 kB

    Total Files

    6

    Last publish

    Collaborators

    • aniketgargya