node-jsonfile: TypeError: fs.readFile is not a function
I am using your example to read data and getting an error with the following Error on line 26 of index.js 26 | fs.readFile(file, options, function (err, data) {
using the following example:
var jsonfile = require('jsonfile')
var file = '/tmp/data.json'
jsonfile.readFile(file, function(err, obj) {
console.dir(obj)
})
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 28 (1 by maintainers)
I’ve done web stuff. This package is suppose to “make it easier” but I feel like its making it more complicated. I can get everything else to work other methods but nothing with this package. @webm0nk3y You’re edited answer makes more sense.