[Node pkg]: Generate Random Data with Faker

Node.js

10/01/2019


Faker documentation (Node.js)

Installation

Use Node Package Manager to install Faker

BASH
$ npm install faker

Usage Example

main.js

JS
var faker = require('faker'); // import package
for(i = 0; i < 20; i ++){
var randEmail = faker.internet.email();
console.log(randEmail);
}

Returns random 20 emails

Random date

JS
var faker = require('faker');
console.log( faker.date.past() );
TEXT
2018-10-14T17:35:04.919Z

Random Address

JS
var faker = require('faker');
console.log(faker.address.streetAddress());
console.log(faker.address.city());
console.log(faker.address.state() + ', ' + faker.address.zipCode());
TEXT
3982 Nitzsche Via
Bednarbury
North Dakota, 21930

WRITTEN BY

Keeping a record