Skip to content
Myr

Docs for "stream threshold" setting

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 18c7f16 · Browse files · 2 files+17 added−1 removed
This commit

State

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

Diff stats

2 files+17 added−1 removed

  • other:+17 added−1 removed

2 files+17 added−1 removed

modified:docs/guide.md+14 added-1 removed
82 unmodified lines
83 * _home_ Application base path used for _res.redirect()_ and transparently handling mounted apps.84 * _views_ Root views directory defaulting to **CWD/views**85 * _view engine_ Default view engine name for views rendered without extensions86 * _view options_ An object specifying global view options87 * _partials_ Root view partials directory defaulting to _views_/partials. 87 * _partials_ Root view partials directory defaulting to _views_/partials.88 * _stream threshold_ Bytesize indicating when a file should be streamed for _res.sendfile()_ using _fs.ReadStream()_ and _sys.pump()_.8990### Routing9192Express utilizes the HTTP verbs to provide a meaningful, expressive routing API.
363 unmodified lines
456support HTTP caching, and does not perform any security checks. This method is utilized457by _res.download()_ to transfer static files, and allows you do to so from outside of458the public directory, so suitable security checks should be applied.459460This method accepts a callback which when given will be called on an exception, as well as when the transfer has completed. When a callback is not given, and the file has __not__ been streamed, _next(err)_ will be called on an exception.461462 res.sendfile(path, function(err, path){463 if (err) {464 // handle the error465 } else {466 console.log('transferred %s', path);467 }468 });469470When the filesize exceeds the _stream threshold_ (defaulting to 32k), the file will be streamed using _fs.ReadStream_ and _sys.pump()_.471472### res.download(file[, filename])473474Transfer the given _file_ as an attachment with optional alternative _filename_.475
279 unmodified lines
modified:lib/express/response.js+3 added
120 unmodified lines
121 * The given callback `fn` is invoked when an error occurs,122 * passing it as the first argument, or when the file is transferred,123 * passing the path as the second argument.124 *125 * When the filesize is >= "stream threshold" (defaulting to 32k), the126 * file will be streamed using an `fs.ReadStream` and `sys.pump()`.127 *128 * @param {String} path129 * @param {Function} fn130 * @api public131 */
208 unmodified lines