There doesn't seem to be any generally approved way of writing an output file in JavaScript - suggestions and/or collaborators would be welcome!