Boffin Codersts-netstorageapi-akamaiby Boffin Coders

Open source · MIT · Node.js 18+

Akamai NetStorage, typed.

A Node.js and TypeScript client and CLI for the Akamai NetStorage API (the NetStorage HTTP API). Upload and download files or buffers, browse and manage directories, with promises or callbacks and a type for every response.

npm install ts-netstorageapi-akamai
CommonJS and ESM2 runtime dependenciesnpm audit: 0Tested on Node 18–24
import Netstorage from "ts-netstorageapi-akamai";

const ns = new Netstorage({
  hostname: "example-nsu.akamaihd.net",
  keyName: "upload-user",
  key: process.env.NETSTORAGE_KEY!,
  cpCode: "123456",
  ssl: true,
});

await ns.uploadAsync("./build/app.js", "/123456/static/");
const { stat } = await ns.statAsync("/123456/static/app.js");
console.log(stat.file[0].size, stat.file[0].md5);

What happens on every call

Each method builds the request, signs it the way NetStorage expects and turns the XML reply into a typed object.

Your code calls a method; the client builds the request, signs it with HMAC-SHA256, sends it to Akamai NetStorage and parses the XML reply into a typed object.

Why this package

Akamai's own Node.js client, netstorageapi, has not had a release since March 2018. This package keeps its method names and callback signatures, so switching is usually a one-line change, and adds what modern projects need.

netstorageapi 1.1.5 (Akamai)ts-netstorageapi-akamai 1.1.1
TypeScript typesNoneConfig, every method and every response
async/awaitCallbacks onlyEvery method also has a promise (…Async) form
Upload or download from memoryFiles onlyuploadBuffer, downloadBuffer
If a local file can't be read during an uploadReports the error, then still sends an empty upload, which can overwrite the file on NetStorageReports the error once and sends nothing
If the connection drops mid-responseThe callback is never calledReports an ECONNRESET error
npm audit on a fresh install (Oct 2026)2 moderate (xml2js prototype pollution)0
Install size12 packages, about 1,200 files8 packages, about 140 files
Command line toolNoakamai-netstorage
Latest releaseMarch 2018Maintained, tested on Node 18, 20, 22 and 24 in CI

Both send the same signed requests (HMAC-SHA256, version 5) and return the same parsed responses, so switching does not change what NetStorage sees. Migrate from netstorageapi →

Everything you need

Types for everything

Config, options and every response are typed, with editor documentation on every method.

Promises or callbacks

Each method has an Async twin. Keep callbacks where you have them.

Buffers in and out

Upload generated content and read files into memory without temporary files.

A command line tool

akamai-netstorage for scripts and CI, with JSON output and clear exit codes.

Safe failure handling

Failed uploads send nothing, and dropped connections report an error instead of hanging.

Small and audited

Two runtime dependencies, a 22 kB package and a clean npm audit.

Fifteen operations

The 13 NetStorage actions the client supports, as 15 methods with a page each.

Transfer

Browse

Manage

Questions people ask

How do I upload a file to Akamai NetStorage from Node.js?

Create a client with your NetStorage hostname, key name and key, then call uploadAsync with the local path and the NetStorage path. A destination ending in / keeps the local file name.

await ns.uploadAsync("./dist/app.js", "/123456/static/");
Is there a TypeScript client for Akamai NetStorage?

Yes. ts-netstorageapi-akamai ships types for the configuration, every method and every response, and each method has a promise form and a callback form.

npm install ts-netstorageapi-akamai
How do I migrate from netstorageapi?

The configuration, method names, arguments and callbacks match Akamai's netstorageapi, so usually only the import changes. The one renamed method is quick_delete, which is quickDelete here.

const Netstorage = require("ts-netstorageapi-akamai").default;
How do I sign NetStorage API requests?

The client signs every request for you with HMAC-SHA256 (version 5) in the X-Akamai-ACS-Auth-Data and X-Akamai-ACS-Auth-Sign headers. Keep your clock within one minute of Akamai's time, or NetStorage answers 403.

const ns = new Netstorage({ hostname, keyName, key, cpCode: "123456", ssl: true });
How do I upload a buffer to NetStorage without writing a temp file?

Use uploadBufferAsync with the Buffer, a file name and the NetStorage path; the content never touches the disk.

await ns.uploadBufferAsync(Buffer.from(JSON.stringify(data)), "data.json", "/123456/api/");
Is there a command line tool for Akamai NetStorage?

Yes. The package installs akamai-netstorage, which reads the upload key from NETSTORAGE_KEY (never from a flag), takes the host and key name from the environment or from --host and --key-name, and supports ls, list, du, stat, upload, download, cat, mkdir, rmdir, rm, rename, symlink, mtime and quick-delete.

npx akamai-netstorage upload ./dist/app.js static/
Why does Akamai NetStorage return 403?

Usually the request signature failed: check that your clock is within one minute of Akamai's, that hostname, keyName and key are right, and that a new upload account has finished propagating, which can take up to 120 minutes.

ns.stat("/123456/file.txt", (err, res) => console.log(res?.statusCode));
Boffin Coders logo

Built by Boffin Coders

Boffin Coders designs and builds websites, web applications and mobile apps for businesses and agencies, and maintains this package as open source. Need Akamai NetStorage uploads, a media pipeline or a Node.js backend built for you?

Hire Node.js developersTalk to usboffincoders.com

Upgrading from 1.0.x? Version 1.1.0 is a drop-in upgrade: your code keeps working without changes. See what changed →