npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

avatar-builder

v1.0.2

Published

Create a beautiful avatar for nodejs

Readme

Avatar Builder

Avatar builder, build multi avatar (cat, github, 8bit, square, identicon, etc) or compose avatar

image

Install

npm install avatar-builder --save

Usage

const Avatar = require('avatar-builder');

const avatar = Avatar.builder(Avatar.Image.margin(Avatar.Image.circleMask(Avatar.Image.identicon())),128,128, {cache: Avatar.Cache.lru()});
avatar.create('gabriel').then(buffer => fs.writeFileSync('avatar-gabriel.png', buffer));
avatar.create('allaigre').then(buffer => fs.writeFileSync('avatar-allaigre.png', buffer));

image image

Content typescript definition

More example in sample.js

Predefined avatar

Triangle

Example 1 :

const Avatar = require('avatar-builder');

const avatar = Avatar.triangleBuilder(128);

avatar.create('gabriel').then(buffer => {/* png buffer */});

image

Square

Source : https://github.com/flouthoc/minBlock.js

Example 1 :

const Avatar = require('avatar-builder');

const avatar = Avatar.squareBuilder(128);

avatar.create('gabriel').then(buffer => {/* png buffer */});

image

Identicon

Source : https://github.com/donpark/identicon

Example 1 :

const Avatar = require('avatar-builder');

const avatar = Avatar.identiconBuilder(128);

avatar.create('gabriel').then(buffer => {/* png buffer */});

image

GitHub

Example 1 :

const Avatar = require('avatar-builder');

const avatar = Avatar.githubBuilder(128);

avatar.create('gabriel').then(buffer => {/* png buffer */});

image

Cat

Images sources : CC-By 4.0 attribution: David Revoy https://framagit.org/Deevad/cat-avatar-generator

Example 1 :

const Avatar = require('avatar-builder');

const avatar = Avatar.catBuilder(128);

avatar.create('gabriel').then(buffer => {/* png buffer */});

image

Example 2 :

const Avatar = require('avatar-builder');

const avatar = Avatar.builder(
                 Avatar.Image.margin(Avatar.Image.roundedRectMask(Avatar.Image.compose(
                   Avatar.Image.randomFillStyle(),
                   Avatar.Image.shadow(Avatar.Image.margin(Avatar.Image.cat(), 8), {blur: 5, offsetX: 2.5, offsetY: -2.5,color:'rgba(0,0,0,0.75)'})
                 ), 32), 8),
                 128, 128);

avatar.create('gabriel').then(buffer => {/* png buffer */});

image

8 bit

Images sources : https://github.com/o1egl/govatar

Example 1 :

const Avatar = require('avatar-builder');

const avatar = Avatar.male8bitBuilder(128);

avatar.create('gabriel').then(buffer => {/* png buffer */});

image

Example 2 :

const Avatar = require('avatar-builder');

const avatar = Avatar.female8bitBuilder(128);

avatar.create('gabriel').then(buffer => {/* png buffer */});

image

Cache

Compose cache

Example, cache with lru and folder

const Avatar = require('avatar-builder');

const avatar = Avatar.catBuilder(128, { cache: Avatar.Cache.compose(Avatar.Cache.lru(), Avatar.Cache.folder()) });

avatar.create('gabriel').then(buffer => {/* png buffer */});

Functions

Builder

| function | description | | --- | --- | | Avatar.builder(image,width,height,options) | Create a avatar builder with image builder and size and options | | Avatar.catBuilder(size,options) | Create a cat avatar builder with size and options | | Avatar.githubBuilder(size,precision,options) | Create a github avatar builder with size and options | | Avatar.triangleBuilder(size,prevision,colors,options) | Create a triangle avatar builder with size and options | | Avatar.identiconBuilder(size,options) | Create a identicon avatar builder with size and options | | Avatar.squareBuilder(size,precision,colors,options) | Create a square avatar builder with size and options | | Avatar.female8bitBuilder(size,options) | Create a 8bit female avatar builder with size and options | | Avatar.male8bitBuilder(size,options) | Create a 8bit male avatar builder with size and options |

Image builder

| function | description | | --- | --- | | Avatar.Image.compose(images) | Compose images | | Avatar.Image.random(images) | Choose random image in list | | Avatar.Image.margin(image,margin) | Add margin to image | | Avatar.Image.fillStyle(fillStyle) | Solid image with color | | Avatar.Image.randomFillStyle(fillStyles) | Solid image with random color | | Avatar.Image.circleMask(image) | Circle mask | | Avatar.Image.roundedRectMask(image,radius) | Rounded rect mask | | Avatar.Image.shadow(image,shadow) | Add shadow below image | | Avatar.Image.scoreShadow(image,shadowColor) | Add score shadow above image | | Avatar.Image.longShadow(image,shadowColor) | Add long shadow below image | | Avatar.Image.group(pathLocation,groups) | Compose png by group | | Avatar.Image.identicon(patchSize,backgroundColor) | Create a identicon image | | Avatar.Image.square(precision,colors) | Create mini block image | | Avatar.Image.triangle(precision,colors) | Create triangle image | | Avatar.Image.github(precision) | Create github image | | Avatar.Image.cat() | Create cat image | | Avatar.Image.male8bit() | Create male 8bit image | | Avatar.Image.female8bit() | Create female 8bit image | | Avatar.Image.grid(image,gridx,gridy) | Create grid with gridx * gridy images |

Cache

| function | description | | --- | --- | | Avatar.Cache.memory() | Use memory cache, all elements in map | | Avatar.Cache.lru(options) | Use LRU cache (default max 50 elements) | | Avatar.Cache.folder(location) | Save element in folder (default ./tmp/avatar) | | Avatar.Cache.compose(caches) | Compose multi cache |