Tagged: nodejs

0

How to read a file as a string in nodejs javascript?

Below code reads the file content in asynchronous manner and the content is returned in the string format and buffered format respectively. let fs = require(“fs-extra”); let path = require(“path”); fs.readFile(path.join(__dirname, “filePath”), “utf8”,(data, err)...

0

path.join in nodejs

path.join() does two things : Joins all given path segments together using the platform specific separator as a delimiter Normalizes the resulting path path.join(‘src/’, ‘js/Router.jsx’); ‘src/js/Router.jsx’ on OSX and Linux ‘srcjsRouter.jsx’ on Windows Here,...