I’m trying to create a file of outputs from my program I’m using fs this is my code so farfs.readfile(‘log.txt’ , ‘ascii’ , function (err , data) { console.log(err) fs.writeFile(‘log.txt’ , data + “\n” + “Hello World” , ‘ascii’ , function (err) { console.log(err) }But inside of log.txt it says undefined and when I run it again undefinedundefined I tried to see what data was outputting and I got a error in the console saying data isn’t a string even though I put ascii in the readFile parameters does anyone know how I can fix this? }
Submitted July 22, 2020 at 03:51PM by RUGMJ7443
No comments:
Post a Comment