var http=require('http'), path=require('path'), fs=require('fs'), www="www", mimes={"jpg":"image/jpeg","webm":"video/webm"}; errors={404:"Not found", 415:"Unsupported Media Type"}; http.createServer(function(req, res) { var med=path.join(www, req.url), mime=mimes[path.extname(med).substring(1)]; if (mime) { var rst=fs.createReadStream(med); rst.on("open", function() {res.writeHead(200, {'Content-Type': mime})}); rst.on("end", function() {res.end();}); rst.on("error", function() {error(res, 404, med)}); rst.pipe(res); } else { error(res, 415, med); } }).listen(3001); function error(res, code, path) { res.writeHead(code, {'Content-Type': "text/html"}); res.end("