Skip to content
Myr

Merge branch 'download' of git://github.com/aheckmann/express into integration

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

authored by visionmedia · committed by visionmedia · parents 33d004f, bd6f24f · Browse files · 4 files+42 added−15 removed
This commit

State

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

Diff stats

4 files+42 added−15 removed

  • tests:+26 added−0 removed
  • other:+16 added−15 removed

4 files+42 added−15 removed

modified:lib/express/plugins/static.js+13 added
modified:lib/express/request.js-13 removed
262 unmodified lines
263 return this264 },265 266 /**267 * Transfer static file at the given _path_ as an attachment.268 * The basename of _path_ is used as the attachment filename.269 *270 * @param {string} path271 * @return {Request}272 * @api public273 */274 275 download: function(path) {276 return this.attachment(basename(path)).sendfile(path)277 },278 279 /**267 * Set Content-Disposition header to 'attachment',268 * with optional file _path_.269 *270 * @param {string} path
76 unmodified lines
modified:spec/spec.plugins.static.js+26 added
72 unmodified lines
73 end74 end75 end76 77 describe '#download()' 78 describe 'when the file exists'79 it 'should set attachment filename'80 get('/report', function(){81 this.download('report.pdf')82 return 'foo'83 })84 get('/report').headers['content-disposition'].should.eql 'attachment; filename="report.pdf"'85 end86 87 it 'should transfer the file'88 get('/public/*', function(file){89 this.download('spec/fixtures/' + file)90 })91 get('/public/user.json').body.should.include '"name":'92 end93 94 it 'should automatically set the content type based on extension'95 get('/public/*', function(file){96 this.download('spec/fixtures/' + file)97 })98 get('/public/user.json').headers['content-type'].should.eql 'application/json'99 end100 end101 end102 103 end104end
modified:Readme.md+3 added-2 removed
25 unmodified lines
26 * Full test coverage27 * Logger plugin with several formats28 * Upload size restrictions29 * Extremely readable specs30 * Cookie support31 32## Installation3334 Install the [Kiwi package manager for nodejs](http://github.com/visionmedia/kiwi)
9 unmodified lines
4445## Performance4647 Extensive performance enhancements have not yet been made,47 since we are focusing on the framework it-self at the moment. 48 since we are focusing on the framework itself at the moment. 49 50 However if you are interested view the premature [benchmarks for Express framework](http://vision-media.ca/resources/nodejs/express-nodejs-web-development-framework-performance).5152## Examples
33 unmodified lines
86 $ node spec/node.js routing87 ...88 89The latest release of Express is compatible with node --version:89 v0.1.3390 v0.1.9091 92EDGE Express we do our best to keep up to date with node's EDGE93 94## More Information
36 unmodified lines