This package provides an unofficial Node.js client for interacting with the Akamai NetStorage HTTP API. It is currently at version `0.6.1` and primarily focuses on maintenance, addressing dependency updates and security vulnerabilities rather than new feature development. The library differentiates itself by providing a seemingly more robust and actively maintained alternative to Akamai's official Node.js NetStorageKit, which the README notes as having "suspicious quality." It offers both stream-based 'Advanced' APIs for uploading and downloading files, and 'Basic' APIs for common file and directory operations like `du`, `dir`, `stat`, `delete`, `mkdir`, `rmdir`, `rename`, and `symlink`. It includes helpers like `fileExists` and provides explicit handling for HTTP response codes in error objects.
npm install akamai-http-apiVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the `akamai-http-api` client using configuration from environment variables and then perform a basic file upload to Akamai NetStorage via a readable stream. It includes local file creation and cleanup.
Be aware of this underlying dependency risk. Monitor 'akamai-http-api' for potential migrations to a modern HTTP client, or consider alternatives if 'request' becomes a critical blocker for your security or compliance needs.
Upgrade to `akamai-http-api@0.6.1` or newer. Regularly run `npm audit` to identify and mitigate any new security advisories.
Implement client-side rate limiting, exponential back-off, or queueing mechanisms if your application performs a high volume of NetStorage operations.
Double-check the `host` value against your Akamai NetStorage configuration. Utilize the `request.timeout` option within `setConfig` to adjust the timeout duration if needed.
Always configure HTTP request timeouts using `akamai.setConfig({ request: { timeout: milliseconds } })`.Implement checks (e.g., using `fileExists` or `stat`) before creating resources, or specifically handle the `err.code === 409` condition in your error callback.
Verify your network stability, ensure the `host` is correctly configured, and check Akamai's rate limit guidance. Consider implementing retry logic with back-off.
Check network connectivity and the correctness of the configured `host`. For large files, consider increasing the `request.timeout` value in `setConfig`.