Answers for "readdirsync fs"

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
11

fs.writefile

const fs = require('fs');

fs.writeFile("/tmp/test", "Hey there!", function(err) {
    if(err) {
        return console.log(err);
    }
    console.log("The file was saved!");
}); 

// Or
fs.writeFileSync('/tmp/test-sync', 'Hey there!');
Posted by: Guest on August-08-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language