mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #10938 from zlumer/patch-2
node-dir: added types for callback params
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="node-dir.d.ts" />
|
||||
|
||||
import * as dir from "node-dir";
|
||||
|
||||
Vendored
+17
-11
@@ -2,8 +2,11 @@
|
||||
// Project: https://github.com/fshost/node-dir
|
||||
// Definitions by: Panu Horsmalahti <https://github.com/panuhorsmalahti/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
///<reference path="../node/node.d.ts"/>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user