How to return ArrayBuffer to the client by Nodejs
<p>I want to use Node.js to return <code>arrayBuffer</code> to the client, but I found some problems. </p>

<p>my node <code>server.js</code>:</p>

<pre><code>res.write(new Buffer([0,1,2]));
res.writeHead(200,{'Access-Control-Allow-Origin':'*','Access-Control-Allow-Method':'GET,POST','Content-Type':'application/octet-stream'});
res.end();
</code></pre>

<p>and my client code:</p>

<pre><code>var xhr = new XMLHttpRequest();
xhr.responseType = "arraybuffer";
xhr.open("post","http://localhost:8008/");
xhr.onload = function(data){
    if (xhr.status === 200) {
        console.log('succuess');
        console.log(typeof this.response);
    }
}
</code></pre>

<p>but the chrome console error:</p>

<pre><code>POST http://localhost:8008/ net::ERR_INVALID_CHUNKED_ENCODING
</code></pre>