I am writing some text to a file us the fs module.
fs.writeFile('result.txt', 'This is my text', function (err) { if (err) throw err; console.log('Results Received'); }); Now this works fine. I want to write this file to a niktoResults folder in my project but when i do
fs.writeFile('/niktoResults/result.txt', 'This is my text', function (err) { if (err) throw err; console.log('Results Received'); }); It results an error. I don't know how to define the directory path that will help me overcome this.
Error: Error: ENOENT: no such file or directory, open '/niktoResults/[object Object].txt'
resultsvariable. It appears that you actual code is different than what you show in the question because the code in your question would not create the error that you see. Please show us the ACTUAL code that causes that error. Only then can people help you.