Problem with .txt file


#1

I’m having this issue : I create and write on a .txt file using javascript, I can read the file with the readFile module but when I open the actual .txt file in the Editor there are no changes.

Here’s the code I’ve been working on, at the very bottom I print the file https://glitch.com/edit/#!/foamy-trapezoid

Thank you in advance!


#2

Hi @alesof, welcome to the Glitch forum!

The problem you’re seeing is probably related to the fact that right now changes on the backend don’t automatically sync with the editor. You’ll need to run the refresh command in the project’s console to see those changes.

Since you’re writing to that file in the backend code, you could make use of Node’s child_process module’s exec command to run refresh when your file is written, but that will trigger your project to restart.

Hope this helps!


#3

Hi @cori, thanks for your fast and useful reply. It did work well.

I’ve a different question to ask which is not strictly related to this problem, should I open a new topic or not? Thanks again!