Skip to content
Myr

docs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent e7df82f · Browse files · 1 file+2 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−9 removed

  • other:+2 added−9 removed

1 file+2 added−9 removed

modified:lib/express/response.js+2 added-9 removed
120 unmodified lines
121/**122 * Transfer the file at the given `path`. Automatically sets 123 * the _Content-Type_ response header via `res.contentType()`. 124 *125 * The given callback `fn` is invoked when an error occurs,126 * passing it as the first argument, or when the file is transferred,127 * passing the path as the second argument.125 * Accepts an optional callback `fn(err, path)`.126 *129 * When the filesize is >= "stream threshold" (defaulting to 32k), the130 * file will be streamed using an `fs.ReadStream` and `sys.pump()`.131 *127 * @param {String} path128 * @param {Function} fn129 * @api public130 */
47 unmodified lines
178 self.contentType(path);179 self.header('Accept-Ranges', 'bytes');180 self.writeHead(status, self.headers);181 if (head) return self.end();187 pump(stream, self, function(err){188 fn && fn(err, path, true);189 });182 pump(stream, self);183 });184};185186/**
204 unmodified lines