diff --git a/types/node-dir/index.d.ts b/types/node-dir/index.d.ts index 5d3a31034a..d5892661b8 100644 --- a/types/node-dir/index.d.ts +++ b/types/node-dir/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for node-dir // Project: https://github.com/fshost/node-dir // Definitions by: Panu Horsmalahti +// James Lismore // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -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; 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; diff --git a/types/node-dir/node-dir-tests.ts b/types/node-dir/node-dir-tests.ts index 7374b45d8d..4c23c9887f 100644 --- a/types/node-dir/node-dir-tests.ts +++ b/types/node-dir/node-dir-tests.ts @@ -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); });