netstorage
Version:
A TypeScript API and CLI for the Akamai NetStorage REST interface
34 lines (33 loc) • 1.35 kB
TypeScript
import { type RequestOptions, type NetStorageClientConfig } from '../index';
/**
* Represents the result of a NetStorage download operation.
* @property status - HTTP status of the download request.
* @property status.code - The HTTP status code returned by the server.
*/
export interface NetStorageDownload {
status: {
code: number;
};
}
/**
* Parameters for the download operation.
* @property fromRemote - The remote NetStorage path to download from.
* @property toLocal - The local file path to write the downloaded content to.
* @property options - Optional request configuration and abort signal.
* @property shouldDownload - Optional predicate to determine whether to proceed with download.
*/
export interface DownloadParams {
fromRemote: string;
toLocal: string;
options?: RequestOptions;
shouldDownload?: () => Promise<boolean>;
}
/**
* Downloads a file from NetStorage to a local path.
* Retries the operation if transient errors occur.
*
* @param config - NetStorage client config containing auth and config.
* @param params - Parameters for the download operation.
* @returns The result status of the download operation.
*/
export declare function download(config: NetStorageClientConfig, { fromRemote, toLocal, options, shouldDownload }: DownloadParams): Promise<NetStorageDownload>;