Just to say, if you're rewriting the entire file, that will cause a whole new file to be written to flash (not just updating one bit). It's not an issue if you're only writing a few times, but you won't want to end up writing a lot!
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Just to say, if you're rewriting the entire file, that will cause a whole new file to be written to flash (not just updating one bit). It's not an issue if you're only writing a few times, but you won't want to end up writing a lot!