Closed kevinresol closed 8 years ago
Thanks for bringing it up.
So are you saying instead of converting bytes to a string, we should directly use res.end(bytes, "binary")
?
I haven't got a nodejs project that uses this at the moment, so if you know what the code should be it will save me some time figuring it out :)
I do have some code on hand, but it is a bit messy. I will try to tidy up and make a PR later.
I am doing some conversion like this, which I think is not necessary:
var buffer = new js.node.Buffer([for(i in 0...bytes.length) bytes.get(i)]);
res.end(buffer, "binary");
It won't work when bytes are converted to string... https://github.com/ufront/ufront-mvc/blob/master/src/ufront/web/context/HttpResponse.hx#L194
then flush... https://github.com/ufront/ufront-mvc/blob/master/src/nodejs/ufront/web/context/HttpResponse.hx#L63
Need to use
res.end(buffer, "binary")