Hi Alon,
thanks for offering your help! I have never worked with node before, but 
when writing the testcase I recognized the error I had in my source. Just 
in case somebody has a use for it (downloading custom binary data from a 
server and storing it to the virtual FS). This is the slightly modified 
version that works as expected (probably needs to be adapted to 
responseType blob when all browsers support it):

xhr = new XMLHttpRequest();
xhr.open("GET", "/msa2/dtest", true);
xhr.responseType = "arraybuffer";
xhr.overrideMimeType("application/octet-stream");
xhr.onreadystatechange = function () {
  if (xhr.readyState === 4 && xhr.status === 200) {
      console.log(xhr.response);
      FS.writeFile('/dtest', new Uint8Array(xhr.response), { encoding: 
"binary" });
      console.log('dtest: '+(FS.stat('/dtest')).size);
  }
};
xhr.send();



Thanks again for caring!
Stefan

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to