diff --git a/node-dir/node-dir-tests.ts b/node-dir/node-dir-tests.ts
index 6cc03ec538..c6442de20f 100644
--- a/node-dir/node-dir-tests.ts
+++ b/node-dir/node-dir-tests.ts
@@ -1,3 +1,4 @@
+///
///
import * as dir from "node-dir";
diff --git a/node-dir/node-dir.d.ts b/node-dir/node-dir.d.ts
index 857cdf7bdf..3b2c91dea2 100644
--- a/node-dir/node-dir.d.ts
+++ b/node-dir/node-dir.d.ts
@@ -2,8 +2,11 @@
// Project: https://github.com/fshost/node-dir
// Definitions by: Panu Horsmalahti
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+///
declare module "node-dir" {
+ import { ReadStream } from "fs";
+
export interface Options {
// file encoding (defaults to 'utf8')
encoding?: string;
@@ -37,29 +40,32 @@ declare module "node-dir" {
}
export interface FileCallback {
- (error: any, content: any, next: () => void): void;
+ (error: any, content: string | Buffer, next: () => void): void;
}
export interface FileNamedCallback {
- (error: any, content: any, filename: string, next: () => void): void;
+ (error: any, content: string | Buffer, filename: string, next: () => void): void;
}
export interface StreamCallback {
- (error: any, stream: any, next: () => void): void;
+ (error: any, stream: ReadStream, next: () => void): void;
}
export interface FinishedCallback {
- (error: any, files: any): void;
+ (error: any, files: string[]): void;
+ }
+ export interface PathsResult {
+ files: string[];
+ dirs: string[];
}
export function readFiles(dir: string, fileCallback: FileCallback, finishedCallback?: FinishedCallback): void;
- export function readFiles(dir: string, fileCallback: FileNamedCallback, finishedCallback?: FinishedCallback): void;
+ export function readFiles(dir: string, fileCallback: FileNamedCallback, finishedCallback?: FinishedCallback): void;
export function readFiles(dir: string, options: Options, fileCallback: FileCallback, finishedCallback?: FinishedCallback): void;
export function readFiles(dir: string, options: Options, fileCallback: FileNamedCallback, finishedCallback?: FinishedCallback): void;
- export function readFilesStream(dir: string, options: Options, streamCallback: StreamCallback,
- finishedCallback?: FinishedCallback): void;
- export function files(dir: string, callback: (error: any, files: any) => void): void;
- export function subdirs(dir: string, callback: (error: any, subdirs: any) => void): void;
- export function paths(dir: string, callback: (error: any, paths: any) => void): void;
- export function paths(dir: string, combine: boolean, callback: (error: any, paths: any) => void): 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 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;
}