Skip to content

Instantly share code, notes, and snippets.

@mape
Created July 10, 2010 02:02
Show Gist options
  • Save mape/470352 to your computer and use it in GitHub Desktop.
Save mape/470352 to your computer and use it in GitHub Desktop.
var gif;
fs.readFile('./trans.gif', function (err, data)
{
if (err) throw err;
gif = new Buffer(data, 'binary');
});
http.createServer(function (req, res)
{
res.writeHead(200, {'Content-Type' : 'image/gif'});
req.setEncoding('binary');
res.write(gif);
res.end();
// Do db magic after the request is sent.
}).listen(80);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment