Last active
December 28, 2015 10:49
-
-
Save tvandervossen/7489079 to your computer and use it in GitHub Desktop.
Quick node.js script to help you test your fancy client-side XHR2 progress bar implementation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var http = require('http') | |
| var sleep = require('sleep') | |
| var server = http.createServer(function (req, res) { | |
| // console.log(req.headers); | |
| req.on('data', function(chunk) { | |
| console.log('chunk: %d bytes', chunk.length) | |
| // console.log(chunk.toString('utf8')) | |
| sleep.sleep(1) | |
| }) | |
| req.on('end', function () { | |
| res.writeHead(200, {'Content-Type': 'text/plain', 'Access-Control-Allow-Origin': '*'}) | |
| res.end('Done, thanks.\n') | |
| }) | |
| }) | |
| server.listen(3000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment