Created
October 16, 2012 22:04
-
-
Save dawnerd/3902346 to your computer and use it in GitHub Desktop.
basic image loader
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
http.createServer(function(req, res){ | |
var path = './images/' + Math.ceil(Math.random()*4) | |
var img = fs.readFileSync(path + '.jpg'); | |
res.writeHead(200, {'Content-Type': 'image/jpg' }); | |
res.end(img, 'binary'); | |
}).listen(80, '127.0.0.1'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment