Skip to content
Myr

Added Request#download()

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

authored by visionmedia · committed by visionmedia · parent 29a14c9 · Browse files · 1 file+17 added−5 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+17 added−5 removed

  • other:+17 added−5 removed

1 file+17 added−5 removed

modified:lib/express/request.js+17 added-5 removed
210 unmodified lines
211 })212 },213 214 /**215 * Transfer static file at the given _path_ as an attachment.216 *217 * @param {string} path218 * @api public219 */220 221 download: function(path) {222 this.attachment(path)223 this.sendfile(path)224 },225 226 /**227 * Set Content-Disposition header to 'attachment',216 * with optional _filename_.228 * with optional file _path_.229 *218 * @param {string} filename230 * @param {string} path231 * @api public232 */233 222 attachment: function(filename) {223 this.header('content-disposition', filename ? 224 'attachment; filename="' + filename + '"' :234 attachment: function(path) {235 this.header('content-disposition', path ? 236 'attachment; filename="' + path + '"' :237 'attachment')238 },239 240 /**
10 unmodified lines