To use Jdenticon on Node.js, start by installing the Jdenticon NPM package. Create an empty directory and run the following command in that directory.

npm install jdenticon

The following code illustrates how to generate an identicon and save it as a PNG file. Save it as test.js in the directory you created above.

const jdenticon = require("jdenticon");
const fs = require("fs");

const size = 200;
const value = "icon value";

const png = jdenticon.toPng(value, size);
fs.writeFileSync("./testicon.png", png);

Run the test file and open testicon.png in the working directory.

node ./test.js