Methods
attachContent(contentPathopt)
Sets a
Content-Disposition
header, causing the client to open a "Save File" dialog or download the file.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
contentPath |
String |
<optional> |
The default name of the file to be downloaded. |
- Source:
endCompressed(data, compressionMethodopt, cbopt, statusCodeopt)
Sends the data or pipes the stream to the client, compressed.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
data |
String | Buffer | Stream | The data to be sent. | ||
compressionMethod |
String |
<optional> |
gzip or deflate . If nothing is passed, the client's most preferred compression method is used, or none if the client does not support gzip or deflate . |
|
cb |
errCallback |
<optional> |
The callback that occurs when all is complete. | |
statusCode |
Number |
<optional> |
200 | The status code to send. |
- Source:
endFile(filePath, cbopt, statusCodeopt, optionsopt)
Automatically reads, compresses (if possible and benefitial), and sends data to the client, read from a file.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
filePath |
String | The path to the file. | ||
cb |
errCallback |
<optional> |
The callback that occurs when all is complete. | |
statusCode |
Number |
<optional> |
200 | The status code to send. |
options |
fileOptions |
<optional> |
Additional options. |
- Source:
redirect(url, statusCodeopt)
Redirects the client to a different page.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
url |
String | The URL to redirect to. | ||
statusCode |
Number |
<optional> |
302 | The status code to send. |
- Source:
uploadFile(filePath, cbopt, statusCodeopt, optionsopt)
Automatically reads, compresses (if possible and benefitial), and sends data to the client, read from a file after setting a
Content-Disposition
header, causing the client to open a "Save File" dialog or download the file.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
filePath |
String | The path to the file. | ||
cb |
errCallback |
<optional> |
The callback that occurs when all is complete. | |
statusCode |
Number |
<optional> |
200 | The status code to send. |
options |
fileOptions |
<optional> |
Additional options. |
- Source: