stringerprint
v1.0.1
Published
🧬 Create a unique, consistent, 32 char digest for a given string
Downloads
971
Maintainers
Readme
stringerprint
🧬 Create a unique, consistent, 32 char digest (AKA fingerprint) for a given string
stringerprint('Troll') // 922a511f02d148e4c9390526d85ca519
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