Skip to content

Instantly share code, notes, and snippets.

@dalmaer
Created June 11, 2012 04:54
Show Gist options
  • Save dalmaer/2908568 to your computer and use it in GitHub Desktop.
Save dalmaer/2908568 to your computer and use it in GitHub Desktop.
A dumb example of delaying some content to see chunked encoding
var http = require('http')
http.createServer(function (request, response) {
response.writeHead(200, {
'Content-Type': 'text/html',
'Transfer-Encoding': 'chunked'
})
response.write("<html><head><title>delay</title></head><body><div id=before>before</div>\n")
setTimeout(function() {
response.end("<div id=after>after</div></body></html>")
}, 6000)
}).listen(3002)
console.log('Server running at http://localhost:3002/')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment