fs.WriteFile doesn't actually write anything to the file

I’m using the following to try to write to a file named output.txt;

fs.writeFile('./output.txt', 'New Request Processed', (err) => { 
   //In case of a error throw err. 
   if (err) throw err; 

the only problem is when I execute this block of code, nothing happens. No error messages and the file is blank. Any ideas on why this might be happening?

Hey @scriptkiddie3141,

Try running refresh in the Glitch Console, so that the file created using fs.writeFileSync shows up in the Glitch project

This works, but is there a way to handle this so that I don’t have to run refresh every time to see updates to the file? I’m going to be writing to it repeatedly.

I don’t think so…because all these changes are made from the console, they cannot be watched for changes either.

You can probably see them without using refresh, by having it being returned by an express GET request. But I don’t think editing can be done, unfortunately…