@sinclair/hammer
Version:
Build Tool for Browser and Node Applications
26 lines (25 loc) • 1.15 kB
TypeScript
/// <reference types="node" />
import { Stats } from 'fs';
export interface Item {
/** The folder used to produce this item. */
folder: string;
/** The path down level from this folder. */
path: string;
/** The stat object for this file or folder. */
stat: Stats;
}
/** Returns true if this path is a folder that exists. */
export declare function folder_exists(folder: string): Promise<boolean>;
/**
* A specialized readdir that returns the {folder, path, stat} for the
* given folder. The 'folder' component returns the absolute path for
* the given folder passed to this function, and the path is the path
* down level from the folder. Thus join(folder, path) yields the full
* path of the item. The stat is a node stat object for the item
* indicating either file or folder.
*/
export declare function common_readdir(folder: string): Promise<Item[]>;
/** Returns a recursive list of a folders contents. */
export declare function common_readdir_flatmap(folder: string): Promise<Item[]>;
/** Deletes this folder. If not exists, then no action. */
export declare function folder_delete(folder: string): Promise<void>;