UNPKG

@augment-vir/node

Version:

A collection of augments, helpers types, functions, and classes only for Node.js (backend) JavaScript environments.

38 lines (37 loc) 1.39 kB
/** * Nested contents read from a file system directory. * * @category Node : File * @category Package : @augment-vir/node * @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node) */ export type DirContents = { [Path in string]: string | DirContents; }; /** * Read all contents within a directory and store them in an object. Optionally recursive. * * @category Node : File * @category Package : @augment-vir/node * @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node) */ export declare function readAllDirContents(dir: string, { recursive, excludeList, }: { recursive?: boolean; excludeList?: ReadonlyArray<string | RegExp> | undefined; }): Promise<DirContents>; /** * Deletes and entire directory and resets it to the given contents. * * @category Node : File * @category Package : @augment-vir/node * @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node) */ export declare function resetDirContents(rootDir: string, contents: Readonly<DirContents>): Promise<void>; /** * Write {@link DirContents} to a directory. * * @category Node : File * @category Package : @augment-vir/node * @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node) */ export declare function writeDirContents(rootDir: string, contents: Readonly<DirContents>): Promise<void>;