Use the StringFromFile function of the community commons. Then pass this string to the Javascript instead of the document.
Regards,
Ronald
[EDIT]
For nanoflow you probably need to think outside of the box. So either generate the string beforehand and save it to the data you sync offline or try to solve it in Javascript. See for instance https://stackoverflow.com/questions/21354235/converting-binary-to-text-using-javascript