netstorage
Version:
A TypeScript API and CLI for the Akamai NetStorage REST interface
40 lines (39 loc) • 1.71 kB
TypeScript
import { type NetStorageClientConfig, type NetStorageFile } from '../../index';
/**
* Represents a file or directory entry during a remote NetStorage walk.
*
* @property {NetStorageFile} file - Metadata about the file or directory.
* @property {string} path - Full path to the entry.
* @property {string} parent - Path of the entry’s parent directory.
* @property {string} relativePath - Path relative to the walk root.
* @property {number} depth - Depth of the entry from the root path.
*/
export interface RemoteWalkEntry {
file: NetStorageFile;
path: string;
parent: string;
relativePath: string;
depth: number;
}
/**
* Parameters to control the remote directory walk behavior.
*
* @property {string} path - The root NetStorage path to begin traversal from.
* @property {number} [maxDepth] - Optional maximum recursion depth.
* @property {(entry: RemoteWalkEntry) => boolean | Promise<boolean>} [shouldInclude] - Predicate to filter entries.
* @property {boolean} [addSyntheticRoot] - Whether to add a synthetic root entry.
*/
export interface RemoteWalkParams {
path: string;
maxDepth?: number;
shouldInclude?: (entry: RemoteWalkEntry) => boolean | Promise<boolean>;
addSyntheticRoot?: boolean;
}
/**
* Initiates a depth-first walk of a NetStorage directory.
*
* @param {NetStorageClientConfig} config - The NetStorage client config.
* @param {RemoteWalkParams} params - Walk parameters.
* @returns {AsyncGenerator<RemoteWalkEntry>} Generator yielding entries found.
*/
export declare function remoteWalk(config: NetStorageClientConfig, { path, maxDepth, shouldInclude, addSyntheticRoot }: RemoteWalkParams): AsyncGenerator<RemoteWalkEntry>;