Skip to content

Instantly share code, notes, and snippets.

@lsm
Created July 2, 2010 09:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsm/461125 to your computer and use it in GitHub Desktop.
Save lsm/461125 to your computer and use it in GitHub Desktop.
function() {
var me = this,
writeHead = me.flaker.writeHead,
write = me.flaker.write,
contentType = mime.lookup(extname(filePath));
fs.stat(filePath, function(err, stat) {
if (err || !stat.isFile()) {
errback ? errback(err) : me.error(404, 'File not found');
return;
}
// you have to call this:
me.flaker.writeHead();
// instead of this:
writeHead();
// otherwise `this` inside `writeHead` will break
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment