0.0.2 • Published 2 months ago
@sroohani/fs-name-gen v0.0.2
Natural file and folder name generator
Auto generates random file and folder names that look perfectly natural.
This is a fork of natural-filename-generator by Christian Rich.
What has changed?
- ES5 to ES6
- JavaScript to TypeScript
- Mocha to Jest
- Dependencies and engines version upgrades
Installation
npm install @sroohani/fs-name-gen
Why?
For a recent project I had to auto generate a lot of file and folder names only they could not look auto generated!
Auto generated strings typically look sequential and are easy to spot e.g
file01.jpg
file01.jpg
file03.jpg
This module builds strings from:
- 4000 common English words
- 4000 celebrity names (dead and living)
- Names of countries and capitals
- Popular topics
- Random numbers (at random lengths)
- Dates (in various formats)
The generator uses a natural distribution curve following Zipf's law
Example
import { NaturalNameGenerator } from "@sroohani/fs-name-gen";
const g = new NaturalNameGenerator();
for (let i = 0; i < 100; i++) {
let name = g.generate("jpg");
console.log(name);
}