2.3.4 • Published 6 months ago
@types/walk v2.3.4
Installation
npm install --save @types/walk
Summary
This package contains type definitions for walk (https://git.coolaj86.com/coolaj86/fs-walk.js).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/walk.
index.d.ts
// Type definitions for walk 2.3
// Project: https://git.coolaj86.com/coolaj86/fs-walk.js
// Definitions by: Pontus Östlund <https://github.com/poppa>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { Stats } from "fs";
export interface WalkStats extends Stats {
name: string;
type: "file"
| "directory"
| "symbolicLink"
| "blockDevice"
| "characterDevice"
| "FIFO"
| "socket";
error?: NodeJS.ErrnoException | undefined;
}
export interface WalkOptionsListeners {
names?: WalkNamesEventCallback | undefined;
files?: WalkStatArrayEventCallback | undefined;
file?: WalkStatEventCallback | undefined;
directories?: WalkStatArrayEventCallback | undefined;
directory?: WalkStatEventCallback | undefined;
end?: WalkStatArrayEventCallback | undefined;
errors?: WalkStatArrayEventCallback | undefined;
nodeError?: WalkStatArrayEventCallback | undefined;
directoryError?: WalkStatArrayEventCallback | undefined;
}
export interface WalkOptions {
followLinks?: boolean | undefined;
filters?: string[] | undefined;
listeners?: WalkOptionsListeners | undefined;
}
export type WalkNext = () => void;
export type WalkStatEventCallback = (
base: string,
names: WalkStats,
next: WalkNext) => void;
export type WalkStatArrayEventCallback = (
base: string,
names: WalkStats[],
next: WalkNext) => void;
export type WalkNamesEventCallback = (
base: string,
names: string[],
next: WalkNext) => void;
export type WalkStatArrayEvent
= 'files'
| 'directories'
| 'errors'
| 'nodeError'
| 'directoryError';
export type WalkStatEvent = 'file' | 'directory';
export interface Walker {
on(event: 'names', cb: WalkNamesEventCallback): void;
on(event: WalkStatArrayEvent, cb: WalkStatArrayEventCallback): void;
on(event: WalkStatEvent, cb: WalkStatEventCallback): void;
on(event: 'end', cb: () => void): void;
pause(): void;
resume(): void;
}
export function walk(path: string, options?: WalkOptions): Walker;
export function walkSync(path: string, options?: WalkOptions): Walker;
Additional Details
- Last updated: Fri, 02 Jul 2021 18:05:14 GMT
- Dependencies: @types/node
- Global values: none
Credits
These definitions were written by Pontus Östlund.