Comparing version 0.0.1 to 0.0.2
0.0.2 / 2012-07-09 | ||
================== | ||
* add passing of req explicitly for now (YUCK) | ||
0.0.1 / 2010-01-03 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -32,4 +32,5 @@ | ||
/** | ||
* Return a `SendStream` for `path`. | ||
* Return a `SendStream` for `req` and `path`. | ||
* | ||
* @param {Request} req | ||
* @param {String} path | ||
@@ -40,4 +41,4 @@ * @return {SendStream} | ||
function send(path) { | ||
return new SendStream(path); | ||
function send(req, path) { | ||
return new SendStream(req, path); | ||
} | ||
@@ -55,2 +56,3 @@ | ||
* | ||
* @param {Request} req | ||
* @param {String} path | ||
@@ -60,4 +62,5 @@ * @api private | ||
function SendStream(path) { | ||
function SendStream(req, path) { | ||
var self = this; | ||
this.req = req; | ||
this.path = path; | ||
@@ -293,3 +296,2 @@ this.maxage(0); | ||
this.res = res; | ||
this.req = res.socket.parser.incoming; // TODO: wtf? | ||
@@ -296,0 +298,0 @@ // invalid request uri |
{ | ||
"name": "send", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Better streaming static file server with Range and conditional-GET support", | ||
@@ -5,0 +5,0 @@ "keywords": ["static", "file", "server"], |
# send | ||
Better streaming static file server for node with Range and conditional-GET support. | ||
Send is Connect's `static()` extracted for generalized use, a streaming static file | ||
server supporting partial responses (Ranges), conditional-GET negotiation, high test coverage, and granular events which may be leveraged to take appropriate actions in your application or framework. | ||
@@ -19,3 +20,3 @@ ## Installation | ||
var app = http.createServer(function(req, res){ | ||
send(req.url).pipe(res); | ||
send(req, req.url).pipe(res); | ||
}); | ||
@@ -46,3 +47,3 @@ ``` | ||
// /www/example.com/public/* | ||
send(url.parse(req.url).pathname) | ||
send(req, url.parse(req.url).pathname) | ||
.root('/www/example.com/public') | ||
@@ -81,8 +82,4 @@ .on('error', error) | ||
## About | ||
## Caching | ||
Send is Connect's `static()` extracted for generalized use, a secure file | ||
server supporting partial responses (Ranges), conditional-GET negotiation, high test coverage, and emits | ||
detailed errors which may be leveraged to take appropriate actions in your application or framework. | ||
It does _not_ perform internal caching, you should use a reverse proxy cache such | ||
@@ -89,0 +86,0 @@ as Varnish for this, or those fancy things called CDNs. If your application is small enough that it would benefit from single-node memory caching, it's small enough that it does not need caching at all ;). |
14431
425
123