This npm package makes working with Gravatar a breeze. You don't need to worry about hashing emails, just use this package.
const userEmail = "email@example.com";// This function will generate the hash that gravatar uses to identify users, will return something similar to xxxxxxxxxxxxxxxxxxxxxconst userHash = ;// This function will generate the url that is accessible by any fetch library, will return something similar toconst gravatarProfileUrl = ;// Fetch gravatar profile with any libraryconst data = await;// 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= />
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!