Boffin Codersts-netstorageapi-akamaiby Boffin Coders

Command line

akamai-netstorage

The package installs a command for scripts and CI. It has no extra dependencies.

Terminal session: upload a file, list a directory, show disk usage and download a file.

Credentials

The upload key comes from the environment, never from a flag, so it stays out of shell history and process lists. Host, key name and CP code can come from the environment or from --host, --key-name and --cp-code.

export NETSTORAGE_HOST=example-nsu.akamaihd.net
export NETSTORAGE_KEYNAME=upload-user
export NETSTORAGE_KEY=...            # from your secret store
export NETSTORAGE_CPCODE=123456      # optional: relative paths go under /123456/
npx akamai-netstorage ls images

Commands

CommandDoes
ls <path>List a directory (--max-entries, --prefix, --start, --end)
list <path>List files recursively
du <path>File count and bytes used
stat <path>File or directory details
upload <local> <remote>Upload a file (a remote ending in / keeps the file name)
download <remote> [local]Download a file; written only when the request succeeds
cat <remote>Write a file to stdout
mkdir / rmdir / rm <path>Create a directory, remove an empty one, delete a file
rename <from> <to>Rename or move a file
symlink <target> <link>Create a symlink
mtime <path> <unix-time>Set the modification time
quick-delete <path> --yesDelete a directory and everything in it

Options

OptionEffect
--jsonPrint the parsed response as JSON
--host, --key-name, --cp-codeOverride the environment variables (the key can only come from NETSTORAGE_KEY)
--insecure-httpUse http instead of https
NETSTORAGE_PROXYEnvironment variable with a proxy URL

Exit codes

CodeMeaning
0Success
1Request or HTTP error (the status is printed to stderr)
2Usage error