UNPKG

@cumulus/ingest

Version:
29 lines 1.57 kB
export interface RecursionFile { type: number | string; name: string; } /** * Handles recursion of a FTP/SFTP list operation * It requests a promisified list function that returns contents of * a directory on a server, filtering on provided regex segments. * * Note that calls to the list function will use either a relative or absolute path, corresponding * to the `configuredPath` passed into this function. The list function will initially be called * with '.' for a relative path or '/' for an absolute path. List functions will need to be able to * normalize or correct these paths as appropriate for their protocol. * * Further calls to the list functions will append the current path to that starting path, such * that all calls will start with either '.' or '/', regardless of additional characters, e.g. * `fn('./path')` vs. `fn('path')`. * * In the case of failure during the recursive list, this function will only apply `path.normalize` * to the `configuredPath` and then call the list function with the entire normalizedPath. * * @param {function} fn - the promisified function for listing a directory * @param {string} configuredPath - path string configured by operator, which may contain * regexes for filtering * @returns {Promise} the promise of an object that has the path is the key and * list of files as values */ export declare function recursion<T extends RecursionFile>(fn: (path: string) => Promise<T[]>, configuredPath: string): Promise<T[]>; //# sourceMappingURL=recursion.d.ts.map