Socket
Socket
Sign inDemoInstall

@types/watch

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/watch

TypeScript definitions for watch


Version published
Weekly downloads
11K
increased by9.85%
Maintainers
1
Weekly downloads
 
Created
Source

Installation

npm install --save @types/watch

Summary

This package contains type definitions for watch (https://github.com/mikeal/watch).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/watch.

index.d.ts

// Imported from: https://github.com/soywiz/typescript-node-definitions/watch.d.ts

/// <reference types="node" />

import fs = require("fs");
import events = require("events");

export interface Files {
    [key: string]: fs.Stats;
}

export interface Monitor extends events.EventEmitter {
    files: Files;

    on(event: "created" | "removed", listener: (f: string, stat: fs.Stats) => void): this;
    on(event: "changed", listener: (f: string, current: fs.Stats, prev: fs.Stats) => void): this;
    on(event: string, listener: (...args: any[]) => void): this;
    stop(): void;
}

export interface BaseOptions {
    ignoreDotFiles?: boolean | undefined;
    filter?(path: string, stat: fs.Stats): boolean;
}

export interface Options extends BaseOptions {
    interval?: number | undefined;
}

export interface WalkOptions extends BaseOptions {
    ignoreUnreadableDir?: boolean | undefined;
    ignoreNotPermitted?: boolean | undefined;
    ignoreDirectoryPattern?: RegExp | undefined;
}

export function watchTree(root: string, callback: (f: string, curr: fs.Stats, prev: fs.Stats) => void): void;
export function watchTree(
    root: string,
    options: Options,
    callback: (f: string, curr: fs.Stats, prev: fs.Stats) => void,
): void;
export function unwatchTree(root: string): void;
export function createMonitor(root: string, callback: (monitor: Monitor) => void): void;
export function createMonitor(root: string, options: Options, callback: (monitor: Monitor) => void): void;
export function walk(root: string, callback: (error: Error | null, files: Files | undefined) => void): void;
export function walk(
    root: string,
    options: WalkOptions,
    callback: (error: Error | null, files: Files | undefined) => void,
): void;

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: @types/node

Credits

These definitions were written by Carlos Ballesteros Velasco, and Gyusun Yeom.

FAQs

Package last updated on 07 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc