That's really a node red thing. If you just google Save data to file in node red you'll find a bunch of stuff. Looks like there's a 'file' node which can just write the contents of the stream of data you have to a file
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.
I guess you're using the code from http://forum.espruino.com/conversations/369336/#comment16246412 ?
That's really a node red thing. If you just google
Save data to file in node red
you'll find a bunch of stuff. Looks like there's a 'file' node which can just write the contents of the stream of data you have to a file