CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
handler.d.ts91 linesDownload Raw Back to esm
1import type { WatchEventType, Stats, FSWatcher as NativeFsWatcher } from 'fs';2import type { FSWatcher, WatchHelper, Throttler } from './index.js';3import type { EntryInfo } from 'readdirp';4export type Path = string;5export declare const STR_DATA = "data";6export declare const STR_END = "end";7export declare const STR_CLOSE = "close";8export declare const EMPTY_FN: () => void;9export declare const IDENTITY_FN: (val: unknown) => unknown;10export declare const isWindows: boolean;11export declare const isMacos: boolean;12export declare const isLinux: boolean;13export declare const isFreeBSD: boolean;14export declare const isIBMi: boolean;15export declare const EVENTS: {16    readonly ALL: "all";17    readonly READY: "ready";18    readonly ADD: "add";19    readonly CHANGE: "change";20    readonly ADD_DIR: "addDir";21    readonly UNLINK: "unlink";22    readonly UNLINK_DIR: "unlinkDir";23    readonly RAW: "raw";24    readonly ERROR: "error";25};26export type EventName = (typeof EVENTS)[keyof typeof EVENTS];27export type FsWatchContainer = {28    listeners: (path: string) => void | Set<any>;29    errHandlers: (err: unknown) => void | Set<any>;30    rawEmitters: (ev: WatchEventType, path: string, opts: unknown) => void | Set<any>;31    watcher: NativeFsWatcher;32    watcherUnusable?: boolean;33};34export interface WatchHandlers {35    listener: (path: string) => void;36    errHandler: (err: unknown) => void;37    rawEmitter: (ev: WatchEventType, path: string, opts: unknown) => void;38}39/**40 * @mixin41 */42export declare class NodeFsHandler {43    fsw: FSWatcher;44    _boundHandleError: (error: unknown) => void;45    constructor(fsW: FSWatcher);46    /**47     * Watch file for changes with fs_watchFile or fs_watch.48     * @param path to file or dir49     * @param listener on fs change50     * @returns closer for the watcher instance51     */52    _watchWithNodeFs(path: string, listener: (path: string, newStats?: any) => void | Promise<void>): (() => void) | undefined;53    /**54     * Watch a file and emit add event if warranted.55     * @returns closer for the watcher instance56     */57    _handleFile(file: Path, stats: Stats, initialAdd: boolean): (() => void) | undefined;58    /**59     * Handle symlinks encountered while reading a dir.60     * @param entry returned by readdirp61     * @param directory path of dir being read62     * @param path of this item63     * @param item basename of this item64     * @returns true if no more processing is needed for this entry.65     */66    _handleSymlink(entry: EntryInfo, directory: string, path: Path, item: string): Promise<boolean | undefined>;67    _handleRead(directory: string, initialAdd: boolean, wh: WatchHelper, target: Path, dir: Path, depth: number, throttler: Throttler): Promise<unknown> | undefined;68    /**69     * Read directory to add / remove files from `@watched` list and re-read it on change.70     * @param dir fs path71     * @param stats72     * @param initialAdd73     * @param depth relative to user-supplied path74     * @param target child path targeted for watch75     * @param wh Common watch helpers for this path76     * @param realpath77     * @returns closer for the watcher instance.78     */79    _handleDir(dir: string, stats: Stats, initialAdd: boolean, depth: number, target: string, wh: WatchHelper, realpath: string): Promise<(() => void) | undefined>;80    /**81     * Handle added file, directory, or glob pattern.82     * Delegates call to _handleFile / _handleDir after checks.83     * @param path to file or ir84     * @param initialAdd was the file added at watch instantiation?85     * @param priorWh depth relative to user-supplied path86     * @param depth Child path actually targeted for watch87     * @param target Child path actually targeted for watch88     */89    _addToNodeFs(path: string, initialAdd: boolean, priorWh: WatchHelper | undefined, depth: number, target?: string): Promise<string | false | undefined>;90}91 
basant307/AI_Governance_Project · CoolFace