staticlayer
v2.0.0
Published
Zero-dependency static file serving middleware with range requests and ETags
Downloads
284
Maintainers
Readme
staticlayer
Zero-dependency static file serving with range requests and ETags.
Installation
npm install staticlayerQuick Start
const staticlayer = require('staticlayer');
const srv = staticlayer({
port: 3300,
dir: './public',
});
srv.listen(() => {
console.log('Static server running on :3300');
});Standalone Mode
PORT=8080 node node_modules/staticlayer/server.jsOptions
| Option | Default | Description |
|--------|---------|-------------|
| port | 3300 | Listen port |
| dir | ./public | Directory to serve files from |
| host | 0.0.0.0 | Bind address |
| userAgent | null | If set, reject requests with non-matching UA |
| keepAliveTimeout | 60000 | Keep-alive timeout (ms) |
| headersTimeout | 65000 | Headers timeout (ms) |
| timeout | 120000 | Request timeout (ms) |
Features
- Range request support (
bytes=start-end) - Content-Disposition attachment headers
- Cache-Control: no-store
- Zero dependencies
License
MIT
