mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add promiseFiles and the sync version of files (#35237)
This commit is contained in:
parent
fcd45613c0
commit
32b5bf0bb7
3
types/node-dir/index.d.ts
vendored
3
types/node-dir/index.d.ts
vendored
@ -1,6 +1,7 @@
|
||||
// Type definitions for node-dir
|
||||
// Project: https://github.com/fshost/node-dir
|
||||
// Definitions by: Panu Horsmalahti <https://github.com/panuhorsmalahti>
|
||||
// James Lismore <https://github.com/jlismore>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
///<reference types="node"/>
|
||||
@ -66,6 +67,8 @@ export function readFiles(dir: string, options: Options, fileCallback: FileNamed
|
||||
export function readFilesStream(dir: string, streamCallback: StreamCallback, finishedCallback?: FinishedCallback): void;
|
||||
export function readFilesStream(dir: string, options: Options, streamCallback: StreamCallback, finishedCallback?: FinishedCallback): void;
|
||||
export function files(dir: string, callback: (error: any, files: string[]) => void): void;
|
||||
export function files(dir: string, syncOption: { sync: true }): string[];
|
||||
export function promiseFiles(dir: string): Promise<string[]>;
|
||||
export function subdirs(dir: string, callback: (error: any, subdirs: string[]) => void): void;
|
||||
export function paths(dir: string, callback: (error: any, paths: PathsResult) => void): void;
|
||||
export function paths(dir: string, combine: boolean, callback: (error: any, paths: string[] | PathsResult) => void): void;
|
||||
|
||||
@ -74,6 +74,14 @@ dir.files("./", function(err, files) {
|
||||
});
|
||||
});
|
||||
|
||||
dir.files("./", { sync: true }).map(file => console.log(file.toLowerCase()));
|
||||
|
||||
dir.promiseFiles("./")
|
||||
.then(files => {
|
||||
console.log(files);
|
||||
})
|
||||
.catch(e => console.error(e));
|
||||
|
||||
dir.subdirs("./", function(err, subdirs) {
|
||||
console.log(subdirs);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user