Skip to content

Commit

Permalink
Exemplo de chunked
Browse files Browse the repository at this point in the history
  • Loading branch information
emerleite committed May 17, 2011
0 parents commit c544604
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions chunked.js
@@ -0,0 +1,20 @@
var http = require('http');
var server = http.createServer(function (req, res) {
res.writeHead(200, {
'Content-Type' : 'text/plain',
'Transfer-Encoding':'chunked'
});
var contador = 0;
var chunkInterval = setInterval(function () {
res.write('Resposta Chunked ' + contador + '\n');
contador++;
}, 100);

setTimeout(function () {
clearInterval(chunkInterval);
res.end('Fim\n');
}, 10000);

});

server.listen(8000);

0 comments on commit c544604

Please sign in to comment.