Answers for "nodejs read file and return as json"

8

read json file node js

function readJsonFile(file) {
    let bufferData = fs.readFileSync(file)
    let stData = bufferData.toString()
    let data = JSON.parse(stData)
    return data
}
Posted by: Guest on June-07-2021

Code answers related to "nodejs read file and return as json"

Code answers related to "Javascript"

Browse Popular Code Answers by Language