Actually it looks like your problem might be that sendFile ends up closing the connection when it's done: https://github.com/espruino/EspruinoTools/blob/gh-pages/index.js#L134
You might have to copy the code out of it and use it directly.
@Gordon started
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.
Actually it looks like your problem might be that sendFile ends up closing the connection when it's done: https://github.com/espruino/EspruinoTools/blob/gh-pages/index.js#L134
You might have to copy the code out of it and use it directly.