{"id":48691,"library":"netstorage","title":"netstorage","description":"A TypeScript API and CLI for the Akamai NetStorage REST interface. Current stable version is 3.1.2, released with ESM-only support. The package provides both programmatic API and a rich CLI with features like bi-directional sync, recursive operations, interactive REPL with tab-completion, built-in retries and rate limiting. It is fully typed and focuses on developer experience with dry-run mode and size aggregation tools. Differentiates itself by being the only maintained TypeScript SDK for Akamai NetStorage with CLI parity.","status":"active","version":"3.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/HeavyMedl/netstorage","tags":["javascript","akamai","netstorage","akamai netstorage","netstorageapi","esm","typescript","api","rest"],"install":[{"cmd":"npm install netstorage","lang":"bash","label":"npm"},{"cmd":"yarn add netstorage","lang":"bash","label":"yarn"},{"cmd":"pnpm add netstorage","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only; CommonJS require will throw an error. Use dynamic import() if needed.","wrong":"const { createConfig } = require('netstorage')","symbol":"createConfig","correct":"import { createConfig } from 'netstorage'"},{"note":"As with all exports, must use ESM import.","wrong":"const uploadDirectory = require('netstorage').uploadDirectory","symbol":"uploadDirectory","correct":"import { uploadDirectory } from 'netstorage'"},{"note":"No common mistake beyond ESM vs CJS mismatch.","wrong":null,"symbol":"downloadDirectory","correct":"import { downloadDirectory } from 'netstorage'"},{"note":"NetStorageConfig is a type, not a value. Use import type to avoid runtime error.","wrong":"import { NetStorageConfig } from 'netstorage'","symbol":"createConfig type","correct":"import type { NetStorageConfig } from 'netstorage'"},{"note":"The library does not export 'ls'; use listDirectory for directory listing.","wrong":"import { ls } from 'netstorage'","symbol":"listDirectory","correct":"import { listDirectory } from 'netstorage'"}],"quickstart":{"code":"import { createConfig, syncDirectory } from 'netstorage';\nimport dotenv from 'dotenv';\ndotenv.config();\n\nconst config = createConfig({\n  key: process.env.NETSTORAGE_KEY ?? '',\n  keyName: process.env.NETSTORAGE_KEY_NAME ?? '',\n  host: process.env.NETSTORAGE_HOST ?? '',\n  cpCode: process.env.NETSTORAGE_CP_CODE ?? '',\n});\n\nasync function main() {\n  try {\n    await syncDirectory(config, {\n      localPath: './local-data',\n      remotePath: '/remote-data',\n      delete: true, // mirror deletion between local and remote\n    });\n    console.log('Sync completed successfully');\n  } catch (error) {\n    console.error('Sync failed:', error);\n  }\n}\n\nmain();","lang":"typescript","description":"Bi-directional sync between a local directory and a remote Akamai NetStorage path, using dotenv for credentials."},"warnings":[{"fix":"If you use require(), migrate to import or dynamic import(). For Node.js, set \"type\": \"module\" in package.json, or use .mjs extension.","message":"Version 3.0.0 dropped CommonJS support entirely; the package is now ESM-only.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use 'npx netstorage config set' instead of 'npx netstorage auth'.","message":"The CLI command 'auth' and REPL auth workflow are deprecated in favor of 'config' commands.","severity":"deprecated","affected_versions":">=3.1.0"},{"fix":"Update calls to uploadFile(config, {localPath, remotePath, ...}) instead of uploadFile(config, localPath, remotePath).","message":"In version 3.0.0, the API method 'uploadFile' signature changed: it now expects an options object instead of multiple arguments.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Adjust rate limit settings via createConfig({maxRetries, retryDelay}) or set highWaterMark for streams.","message":"Rate limiting is enabled by default; if you hit Akamai limits, the library will retry but may appear slow.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Use 'pwd' to see current remote directory. Use absolute paths starting with '/' to avoid context issues.","message":"The REPL uses a working directory context; commands like 'upload' default to current remote directory, not root.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Install dotenv and call dotenv.config() at entry point, or hardcode credentials (not recommended).","message":"Environment variables are not automatically loaded; you must use dotenv or similar before calling createConfig.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"search_vec":"'3.1.2':17 'aggreg':72 'akamai':9,84,90,92 'api':4,29,97 'bi':38 'bi-direct':37 'built':50 'built-in':49 'cli':6,33,87 'complet':48 'current':13 'develop':63 'differenti':74 'direct':39 'dri':67 'dry-run':66 'esm':21,95 'esm-on':20 'experi':64 'featur':35 'focus':61 'fulli':58 'interact':43 'interfac':12 'javascript':89 'like':36 'limit':55 'maintain':80 'mode':69 'netstorag':1,10,85,91,93 'netstorageapi':94 'oper':42 'packag':25 'pariti':88 'programmat':28 'provid':26 'rate':54 'recurs':41 'releas':18 'repl':44 'rest':11,98 'retri':52 'rich':32 'run':68 'sdk':82 'size':71 'stabl':14 'support':23 'sync':40 'tab':47 'tab-complet':46 'tool':73 'type':59 'typescript':3,81,96 'version':15","created_at":"2026-06-07T16:57:57.175914+00:00","updated_at":"2026-06-07T16:57:57.175914+00:00","problems":[{"fix":"Use import instead: change 'require(\"netstorage\")' to 'await import(\"netstorage\")'. Also ensure your project is ESM or use dynamic import.","cause":"Using CommonJS require() on an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/netstorage/dist/index.js from /path/your.js not supported."},{"fix":"Use named import: import { createConfig } from 'netstorage'. Do not use import netstorage from 'netstorage'.","cause":"Attempting to call createConfig without importing it (e.g., using default import mistakenly).","error":"TypeError: createConfig is not a function"},{"fix":"Ensure all four fields are provided in the config object. Use environment variables as shown in the quickstart.","cause":"createConfig missing one or more required properties.","error":"Error: Missing required credentials: key, keyName, host, cpCode"},{"fix":"Verify your key, keyName, host, and cpCode. Use 'npx netstorage config show' to check current configuration.","cause":"Akamai NetStorage credentials are invalid or CP code is incorrect.","error":"Error 403 Forbidden: Access denied"},{"fix":"Check that the local path points to a file, not a directory. Use uploadDirectory for directories.","cause":"Attempting to upload a file that doesn't exist or is a directory.","error":"Error: stream is not readable or end() called with data in iterative write"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/HeavyMedl/netstorage","github":"https://github.com/HeavyMedl/netstorage","docs":null,"changelog":null,"pypi":null,"npm":"netstorage","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}