Nautical Pirate Moustache

    @types/walk
    TypeScript icon, indicating that this package has built-in type declarations

    2.3.1 • Public • Published

    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.

    Keywords

    none

    Install

    npm i @types/walk

    DownloadsWeekly Downloads

    5,250

    Version

    2.3.1

    License

    MIT

    Unpacked Size

    7.01 kB

    Total Files

    4

    Last publish

    Collaborators

    • types