An Akamai NetStorage API client for TypeScript and Node.js
Akamai's own Node.js client for NetStorage uses callbacks and ships no types. We needed typed, promise-based calls and uploads straight from memory, so we wrote ts-netstorageapi-akamai: the 13 NetStorage actions, signed requests, a command line tool and the same method names as Akamai's package, so switching is usually a one-line change.
- ts-netstorageapi-akamai 1.1.1 on npm, released 29 Oct 2026
- MIT licence, tested on every change
- TypeScript
- Node.js 18+
- MIT
npm install ts-netstorageapi-akamai13
NetStorage actions
Upload, download, dir, list, du, stat, mkdir, rmdir, rename, symlink, mtime, delete, quick-delete
2
Runtime dependencies
xml2js for the replies and https-proxy-agent for proxies
4
Node versions in CI
Tested on Node 18, 20, 22 and 24 on every change
MIT
Licence
Free for commercial projects
Akamai's client had no types
NetStorage is Akamai's storage for content served through its CDN: video segments, images, downloads, static builds. Akamai publishes an HTTP API for it and a Node.js package, netstorageapi, written for callback-style JavaScript, with no type definitions and no way to upload from memory.
We needed types for every response, async and await, and uploads of generated files without writing them to disk first. So we ported Akamai's client to TypeScript and kept its configuration object, method names, arguments and callback signatures. In most code only the import changes; the one renamed method is quick_delete, now quickDelete.
Version 1.1 added a command line tool, a test suite against a mock NetStorage server and CI, which now runs on Node 18, 20, 22 and 24. Both clients send the same signed requests, so switching changes nothing NetStorage sees.
Thirteen NetStorage actions, typed
One client object, the 13 NetStorage HTTP API actions, and a command line tool for scripts and CI pipelines.
Uploads and downloads
uploadBuffer and downloadBuffer for generated content.Inspect storage
dir, list, du and stat return typed objects parsed from NetStorage's XML replies.Manage files
mkdir, rmdir, rename, symlink, mtime, delete and quickDelete for whole directory trees.Promises or callbacks
…Async promise form beside Akamai's callback form.Command line
akamai-netstorage command reads the upload key from the environment, never from a flag, and prints JSON on request.Signed requests
15 operations · a callback and a promise each
callbackns.stat(path, (err, res, body) => { … })
promiseconst { stat } = await ns.statAsync(path)
Read
4 methods
stat()statAsync()
file or directory details
dir()dirAsync()
list one directory
list()listAsync()
list recursively, resumable
du()duAsync()
file count and bytes used
Typed as StatResponse, DirResponse, ListResponse and DuResponse.
Transfer
4 methods
upload()uploadAsync()
local file → NetStorage
uploadBuffer()uploadBufferAsync()
Buffer → NetStorage
download()downloadAsync()
NetStorage → local file
downloadBuffer()downloadBufferAsync()
NetStorage → memory
Buffers go straight to and from memory, with no temporary files.
Paths
4 methods
mkdir()mkdirAsync()
create a directory
rmdir()rmdirAsync()
remove an empty directory
rename()renameAsync()
rename or move a file
symlink()symlinkAsync()
create a symlink
Create, remove, move and link, each with its own response type.
Admin
3 methods
mtime()mtimeAsync()
set modification time
delete()deleteAsync()
delete a file or symlink
quickDelete()quickDeleteAsync()
delete a whole tree
Timestamps and deletes, from one file to a whole tree.
Akamai and NetStorage are trademarks of Akamai Technologies. ts-netstorageapi-akamai is not affiliated with or endorsed by Akamai.
Upload a build to NetStorage
Create a client with your NetStorage upload account, then await any method. Every call and every response is typed.
npm install ts-netstorageapi-akamai1import Netstorage from "ts-netstorageapi-akamai";
2
3const ns = new Netstorage({
4 hostname: "example-nsu.akamaihd.net",
5 keyName: "upload-user",
6 key: process.env.NETSTORAGE_KEY!,
7 cpCode: "123456",
8 ssl: true,
9});
10
11await ns.uploadAsync("./build/app.js", "/123456/static/");
12const { stat } = await ns.statAsync("/123456/static/app.js");
13console.log(stat.file[0].size, stat.file[0].md5);The full guide, every method and more examples are on the documentation site.
Is it the right client?
A good fit when
- Your content lives on Akamai NetStorage and your code is Node.js or TypeScript
- You want types,
asyncandawait, or uploads from memory - You run
netstorageapitoday: the method names and arguments match, apart from quick_delete - Deploy scripts and CI need a NetStorage command line tool
Not the right tool when
- Your storage is Akamai Object Storage: it speaks the S3 API, so use an S3 client
- Your code runs in a browser: the client is built for Node.js, and a NetStorage key should never ship to a browser
- You need Node.js older than 18
Tested against a mock NetStorage
The test suite runs the client against a local server that answers like NetStorage, so every method is checked without touching a real account.
Request signing
The signature matches Akamai's own netstorageapi for a fixed time and nonce, and the mock server verifies every request's signature.
Every method
Every method's request is tested in both callback and promise forms, along with the parsed XML replies and error statuses.
Node 18 to 24
CI runs the build and tests on four Node versions on every change.
Documentation site
A page per method, a migration guide from netstorageapi, the CLI and an API reference.
Where this work shows up
Media platforms, Node.js back ends and the delivery pipelines behind them.
Streaming platforms whose video and images sit on CDN storage like NetStorage.
The team that wrote this client builds Node.js and TypeScript back ends.
Applications with real storage, delivery and deployment behind them.
The other packages we maintain
durable_queue
A persistent task queue for Dart and Flutter. Uploads, messages and syncs are saved before they run, retried with backoff and recovered after a crash, and uploads can finish after the app is closed.
fundamental-analysis
Financial ratios and fundamental analysis for JavaScript and TypeScript: valuation multiples, Piotroski F-Score, Altman Z, DCF and intrinsic value, with plain-English ratings and zero dependencies.
Every package, with its documentation and source: open source by Boffin Coders.
ts-netstorageapi-akamai: common questions
Not answered here?
Moving files through Akamai, or building around it?
We wrote and maintain this client. Tell us what your delivery pipeline needs to do, and we will show you how we would build it.