Skip to content

Instantly share code, notes, and snippets.

@Marak
Created February 25, 2010 19:12
Show Gist options
  • Save Marak/314924 to your computer and use it in GitHub Desktop.
Save Marak/314924 to your computer and use it in GitHub Desktop.
fs.readFile(path, 'binary', function (error, content)
{
if (error) {
resp.sendHeader(200,{'Content-Type':'text/html'});
resp.write('404 file not found');
resp.close();
}
else {
resp.sendHeader(200,{'Content-Type':mime.mime(path)});
resp.write(content, 'binary');
resp.close();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment