0.4.0 • Published 10 years ago

ex-static v0.4.0

Weekly downloads
13
License
-
Repository
github
Last release
10 years ago

ex-static

Serves files. It's pretty fast.

To use:

var http = require('http');
var static = require('ex-static');

var files = [
	{url: '/', path: 'static/index.html'},
	{url: '/test.jar', path: 'static/test.jar', type: 'application/java-archive', cache: 300000, compress: true}
];

http.createServer(static(files)).listen(80);
  • cache - Sets the number of seconds on the Cache-Control: max-age header. Using 0 sets no header.
  • type - Used to specify a Content-Type, or override the default type associated with the file extension.
  • compress - Set whether we should use compression. Small files have it on by default.
  • stream - True if the file should be streamed to the client, false if it should be written in one chunk. Defaults to true for small files.
  • path - The local file path where the file can be found.
  • url - The url where the file should be served.

All files have ETag values that are the MD5 hashes of their contents.

Small files are compressed with gzip for browsers that support it. To override the default compression setting for a file, use the compress parameter.

0.4.0

10 years ago

0.3.0

12 years ago

0.2.2

12 years ago

0.2.0

12 years ago