UNPKG

netstorage

Version:

A TypeScript API and CLI for the Akamai NetStorage REST interface

35 lines (34 loc) 1.49 kB
/** * Represents a file or directory encountered during traversal. * * @property {string} localPath - Absolute path to the file or directory. * @property {string} relativePath - Path relative to the traversal root. * @property {boolean} isDirectory - Indicates if the entry is a directory. */ export interface LocalWalkEntry { localPath: string; relativePath: string; isDirectory: boolean; } /** * Configuration options for walking a local directory tree. * * @property {string[]} [ignore] - Glob patterns to exclude during traversal. * @property {boolean} [followSymlinks] - Follow symbolic links if true. * @property {boolean} [includeDirs] - Yield directory entries if true. * @property {(dirPath: string, relativePath: string) => void} [onEnterDir] - Callback when entering a directory. */ export interface WalkLocalOptions { ignore?: string[]; followSymlinks?: boolean; includeDirs?: boolean; onEnterDir?: (dirPath: string, relativePath: string) => void; } /** * Recursively walks a local directory tree, yielding files and optionally directories. * * @param {string} root - Root directory to begin traversal. * @param {WalkLocalOptions} [options] - Options to configure traversal behavior. * @returns {AsyncGenerator<LocalWalkEntry>} Yields matching file and directory entries. */ export declare function walkLocalDir(root: string, { ignore, followSymlinks, includeDirs, onEnterDir, }?: WalkLocalOptions): AsyncGenerator<LocalWalkEntry>;