Transfer
upload PUT
Upload a local file to Akamai NetStorage.
await ns.uploadAsync("./dist/app.js", "/123456/static/");
// uploaded as /123456/static/app.jsns.upload("./dist/app.js", "/123456/static/app.js", (err, res, body) => {
if (err) return console.error(err);
console.log(res?.statusCode, body); // 200 { message: 'Request Processed.' }
});npx akamai-netstorage upload ./dist/app.js static/Signatures
uploadAsync(local_source: string, ns_destination: string): Promise<UploadResponse>
upload(local_source: string, ns_destination: string, callback: (err: any, res?: http.IncomingMessage, body?: UploadResponse) => void): void
Parameters
| Name | Type | Description |
|---|---|---|
local_source | string | Path of the local file. |
ns_destination | string | NetStorage path. End it with / to keep the local file name. |
Returns
UploadResponse
{ message: "Request Processed." }
On the wire
| HTTP method | PUT |
| X-Akamai-ACS-Action | version=1&action=upload |
| Signed with | X-Akamai-ACS-Auth-Data and X-Akamai-ACS-Auth-Sign (HMAC-SHA256) |
| CLI | akamai-netstorage upload ./dist/app.js static/ |
Build and sign this request in the playground →
Notes
- Directories cannot be uploaded; pass a file.
- If the local file cannot be read, the error is reported and nothing is sent.
- The file is read into memory before it is sent. NetStorage accepts objects up to 150 GB; split files over 100 GB into parts.
- Uploads count as writes: about 50 per second per storage group.