I am writing in Node.js.
And the in console I see the file names, and after that many strings: "File written", and in file I see one string with first filename in folder
Q: How do I write to TXT file an array with filenames from folder in Javascript?
Here is my code:
const WebmUrl = new URL('file:///D:/MY PROJCT/webm/hlp.txt');
fs.readdirSync(testFolder).forEach(file => {
console.log(file)
fs.writeFile(WebmUrl, file, function(err){
if(err) {
console.log(err)
} else {
console.log('File written!');
}
});
})