Skip to content

Instantly share code, notes, and snippets.

@caseywatts
Last active May 2, 2024 06:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caseywatts/653c762abe1cada63d56f66924f3c794 to your computer and use it in GitHub Desktop.
Save caseywatts/653c762abe1cada63d56f66924f3c794 to your computer and use it in GitHub Desktop.
Using Faker in the Node.js REPL

I learned how to open a module in a Node REPL thanks to this StackOverflow post

How to use Faker in a Node.js REPL

  1. npm install --save-dev "@faker-js/faker
    • = install Faker to your repository
    • (I made an empty project folder because idk how to find -g global ones in node)
  2. node --experimental-repl-await
    • = open the Node REPL with the experimental await feature
  3. let { faker } = await import('@faker-js/faker')
    • = import Faker in the Node REPL
  4. faker.animal.dog()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment