Skip to content

Instantly share code, notes, and snippets.

@Marak
Created March 28, 2010 06:23
Show Gist options
  • Save Marak/346605 to your computer and use it in GitHub Desktop.
Save Marak/346605 to your computer and use it in GitHub Desktop.
var promise = fs.readFile(filename, encoding);
promise.addCallback(function (data) {
body = data;
headers = [ [ "Content-Type" , content_type ]
, [ "Content-Length" , body.length ]
];
if (!DEBUG)
headers.push(["Cache-Control", "public"]);
sys.puts("static file " + filename + " loaded");
callback();
});
promise.addErrback(function () {
sys.puts("Error loading " + filename);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment