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 759a57b · Browse files · 1 file+10 added−2 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+10 added−2 removed

  • other:+10 added−2 removed

1 file+10 added−2 removed

modified:docs/guide.md+10 added-2 removed
814 unmodified lines
815 res.sendfile(path, { bufferSize: 1024 }, function(err){816 // handle817 });818819### res.download(file[, filename[, callback]])819### res.download(file[, filename[, callback[, callback2]]])820821Transfer the given _file_ as an attachment with optional alternative _filename_.822823 res.download('path/to/image.png');
3 unmodified lines
827828 res.attachment(file);829 res.sendfile(file);830831An optional callback may be supplied as either the second or third argument, which is passed to _res.sendfile()_:831An optional callback may be supplied as either the second or third argument, which is passed to _res.sendfile()_. Within this callback you may still respond, as the header has not been sent.832833 res.download(path, 'expenses.doc', function(err){834 // handle835 });836837An optional second callback, _callback2_ may be given to allow you to act on connection related errors, however you should not attempt to respond.838839 res.download(path, function(err){840 // error or finished841 }, function(err){842 // connection related error843 });844845### res.send(body|status[, headers|status[, status]])846847The _res.send()_ method is a high level response utility allowing you to pass848objects to respond with json, strings for html, Buffer instances, or numbers representing the status code. The following are all valid uses:
492 unmodified lines