🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

navatar

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

navatar

<object data="https://navatar-demo.herokuapp.com/avatar/try-it!.svg"></object>

1.0.4
latest
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

#Navatar, the Node.js Avatar Generator

Generate visually-pleasing, unique avatars using Node.js

###Check out the demo!

Key Features

  • Easily add randomly generated avatars to your existing Express application using the built-in middleware
  • Generate fast SVG images that look good at any size

Notes

  • For production performance, it is recommended that you cache generated images as PNGs using your exisitng file server
  • No support for PNG files yet (you can optionally read the SVG from the route and convert into a PNG using svg2png - this process works but is slow)

How it works

Navatar uses built-in algorithms to create cellular automata, a la Stephen Wolfram's "A New Kind of Science", which heavily influenced this project. When the MiddleWare is invoked, an SVG is randomly generated based on the key provided, and sent to the user.

Usage

  • First, install via NPM
npm install --save navatar
  • Then, add as express MiddleWare...
const { getNavatarMiddleware } = require('navatar');
const express = require(`express`);
const app = new express();
app.use('/avatar/:key.svg',getNavatarMiddleware());
app.listen(666);

Now, your /avatar route will serve up SVGs!

Options

Custom width and height

Pass width and height as query paramaters to modify the size of the generated glyph. (It is recommended to use the same value for width and height.)

//example
http://localhost/avatar/this-rocks.svg?height=150&width=150

Coming Soon!

  • Support for additional tree-generation algorithms
  • Better color palette support
  • PNG support (one day!)

License

CC BY

FAQs

Package last updated on 22 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts