J
J
jeruthadam2017-09-06 20:03:46
Node.js
jeruthadam, 2017-09-06 20:03:46

What is the best way to read data from a file: fileRead or require?

There is a JSON file that acts as a mini database for storing data from a small site.
What is the best way to read data from there?
Now everything works just Do I need to include fs.readFile (or async)? What's the difference anyway?
const data = require('./data.json')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Coder321, 2017-09-08
@Coder321

Use https://github.com/louischatriot/nedb

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question