Reading files with Node.js

PHOTO EMBED

Mon Feb 07 2022 22:10:59 GMT+0000 (Coordinated Universal Time)

Saved by @Mojtaba #javascript

const fs = require('fs')


fs.readFile('/Users/joe/test.txt', 'utf8' , (err, data) => {
  if (err) {
    console.error(err)
    return
  }
  console.log(data)
})

content_copyCOPY

https://nodejs.dev/learn/reading-files-with-nodejs