Answers for "fs.readdirSync(path)"

4

fs.readdirSync nodejs

The fs.readdirSync() method is used to synchronously read the contents
of a given directory.
The method returns an array with all the file names 
or objects in the directory. The options argument can be used to change the
format in which the files are returned from the method.

fs.readdirSync( path, options )
Posted by: Guest on August-11-2021
7

nodejs readfile

const fs = require('fs');

fs.readFile('/Users/joe/test.txt', 'utf8' , (err, data) => {
  if (err) {
    console.error(err);
    return
  }
  console.log(data);
});
Posted by: Guest on August-30-2020
0

fs readfile encoding

fs.readFile('/etc/passwd', 'utf8', callback);
Posted by: Guest on April-17-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language