Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Apr 11, 2011
1 parent 759a57b commit 236a412
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ Options may also be passed to the internal _fs.createReadStream()_ call, for exa
// handle
});

### res.download(file[, filename[, callback]])
### res.download(file[, filename[, callback[, callback2]]])

Transfer the given _file_ as an attachment with optional alternative _filename_.

Expand All @@ -828,12 +828,20 @@ This is equivalent to:
res.attachment(file);
res.sendfile(file);

An optional callback may be supplied as either the second or third argument, which is passed to _res.sendfile()_:
An 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.

res.download(path, 'expenses.doc', function(err){
// handle
});

An optional second callback, _callback2_ may be given to allow you to act on connection related errors, however you should not attempt to respond.

res.download(path, function(err){
// error or finished
}, function(err){
// connection related error
});

### res.send(body|status[, headers|status[, status]])

The _res.send()_ method is a high level response utility allowing you to pass
Expand Down

0 comments on commit 236a412

Please sign in to comment.