stringerprint
🧬 Create a unique, consistent, 32 char digest (AKA fingerprint) for a given string
stringerprint('Troll')
Use case: Create a file fingerprint
const { promises: { readFile, writeFile } } = require('fs');
const stringerprint = require('stringerprint');
const contents = await readFile(filename);
const fingerprint = stringerprint(contents);
const path = filename.split('.');
path.splice(array.length - 1, 0, fingerprint);
await writeFile(path.join('.'), contents);
- In:
/path/to/file.js
- Out:
/path/to/file.922a511f02d148e4c9390526d85ca519.js