UNPKG

netstorage

Version:

A TypeScript API and CLI for the Akamai NetStorage REST interface

49 lines (48 loc) 1.97 kB
import { type NetStorageClientConfig, type NetStorageDownload, type RemoteWalkEntry } from '../../index'; /** * Options for downloading a remote directory to the local filesystem. * * @property remotePath Absolute path to the remote directory. * @property localPath Local destination path. * @property overwrite Whether to overwrite existing local files. Default is false. * @property dryRun If true, simulates the operation without downloading. * @property maxConcurrency Maximum number of concurrent downloads. * @property onDownload Callback for each successfully downloaded file. * @property onSkip Callback for each skipped file with reason. * @property shouldDownload Optional filter function to determine whether to download a file. */ export interface DownloadDirectoryParams { remotePath: string; localPath: string; overwrite?: boolean; dryRun?: boolean; maxConcurrency?: number; onDownload?: (info: { remotePath: string; localPath: string; }) => void; onSkip?: (info: { remotePath: string; localPath: string; reason: 'exists' | 'dryRun' | 'overwriteFalse' | 'error' | 'filtered'; error?: unknown; }) => void; shouldDownload?: (entry: RemoteWalkEntry) => boolean | Promise<boolean>; } /** * Represents the result of downloading a single file in a directory download operation. * * @property remotePath - Absolute path to the remote file in NetStorage. * @property localPath - Local filesystem path where the file was saved. */ export interface DownloadResult extends NetStorageDownload { remotePath: string; localPath: string; } /** * Downloads all files from a remote directory to a local path, respecting filters and concurrency. * * @param config NetStorage client config. * @param params Download options. */ export declare function downloadDirectory(config: NetStorageClientConfig, params: DownloadDirectoryParams): Promise<DownloadResult[]>;