Very simple static file handler, with a few electives.
npm install lactate
Just pass three arguments to the serve function (
response). Lactate will stream your file to the client in the most efficient way, by piping: readFile > gZip > response.
var express =var app = expressvar lactate =appappappapp
Options can be passed to the initialization function or using the
//Passing to initialization functionvar lactate = expires:172800//Set methodlactate//Either function accepts (key, value) or an object.
Available options are currently
expires (seconds), and
cache option will have Lactate save your files in memory. By default this is enabled, and there's no great reason to disable it.
expires will have Lactase set appropriate
Cache-Control headers for client-side caching. This option represents seconds-from-now to expire.
Debugging is level-based. The
debug function accepts a number and a callback function, or a boolean. By default, the debugging function is console.log. The following syntaxes are valid.
var lactate =debug:truelactatelactatelactate
More robust debugging will come in the future as I isolate the functionality into a module of its own.