Transfer
download GET
Download a file from NetStorage to the local disk.
await ns.downloadAsync("/123456/static/app.js", "./backup/");
// saved as ./backup/app.jsns.download("/123456/static/app.js", "./app.js", (err, res) => {
if (!err && res?.statusCode !== 200) console.error("NetStorage returned", res?.statusCode);
});npx akamai-netstorage download static/app.js backup/Signatures
downloadAsync(ns_path: string, local_destination: string): Promise<DownloadResponse>
download(ns_path: string, local_destination: string, callback: (err: any, res?: http.IncomingMessage, body?: DownloadResponse) => void): void
Parameters
| Name | Type | Description |
|---|---|---|
ns_path | string | NetStorage file path (not a directory). |
local_destination | string | Local file or existing directory. Pass "" to save under the NetStorage name in the current directory. |
Returns
DownloadResponse
{ message: "Download Done." }
On the wire
| HTTP method | GET |
| X-Akamai-ACS-Action | version=1&action=download |
| Signed with | X-Akamai-ACS-Auth-Data and X-Akamai-ACS-Auth-Sign (HMAC-SHA256) |
| CLI | akamai-netstorage download static/app.js backup/ |
Build and sign this request in the playground →
Notes
- The response body is written whatever the HTTP status; use the callback form or
statfirst if the file may be missing. - If the connection drops before the file is complete, an
ECONNRESETerror is reported and nothing is written. - The file is held in memory before it is written. Akamai recommends not downloading files over 1 GB through the HTTP API; serve them through a delivery product instead.