mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-01-30 05:27:30 +00:00
Add missing walk() method to fs-extra (#13070)
* Add walk() to fs-extra * Fix some indentation in fs-extra
This commit is contained in:
parent
602a847455
commit
17264e0456
@ -101,3 +101,12 @@ fs.ensureSymlink(path, errorCallback);
|
||||
fs.ensureSymlinkSync(path);
|
||||
fs.emptyDir(path, errorCallback);
|
||||
fs.emptyDirSync(path);
|
||||
|
||||
var items: string[];
|
||||
fs.walk("my-path")
|
||||
.on('data', function (item) {
|
||||
items.push(item.path);
|
||||
})
|
||||
.on('end', function () {
|
||||
console.dir(items);
|
||||
});
|
||||
|
||||
28
fs-extra/index.d.ts
vendored
28
fs-extra/index.d.ts
vendored
@ -8,6 +8,7 @@
|
||||
/// <reference types="node" />
|
||||
|
||||
import * as stream from 'stream';
|
||||
import { Stats } from "fs";
|
||||
export * from "fs";
|
||||
|
||||
export declare function copy(src: string, dest: string, callback?: (err: Error) => void): void;
|
||||
@ -72,8 +73,21 @@ export declare function ensureSymlinkSync(path: string): void;
|
||||
|
||||
export declare function emptyDir(path: string, callback?: (err: Error) => void): void;
|
||||
export declare function emptyDirSync(path: string): boolean;
|
||||
|
||||
export interface CopyFilterFunction {
|
||||
|
||||
export interface WalkEventEmitter {
|
||||
on(event: 'data', callback: (file: WalkEventFile) => void): WalkEventEmitter;
|
||||
on(event: 'end', callback: () => void): WalkEventEmitter;
|
||||
on(event: string, callback: Function): WalkEventEmitter;
|
||||
}
|
||||
|
||||
export interface WalkEventFile {
|
||||
path: string;
|
||||
stats: Stats;
|
||||
}
|
||||
|
||||
export function walk(path: string, options?: {}): WalkEventEmitter;
|
||||
|
||||
export interface CopyFilterFunction {
|
||||
(src: string): boolean
|
||||
}
|
||||
|
||||
@ -86,11 +100,11 @@ export interface CopyOptions {
|
||||
filter?: CopyFilter
|
||||
recursive?: boolean
|
||||
}
|
||||
|
||||
export interface MoveOptions {
|
||||
clobber? : boolean;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export interface MoveOptions {
|
||||
clobber? : boolean;
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export interface MoveOptions {
|
||||
clobber? : boolean;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user