Hyperlinkv0.8.0-beta.28

FileSystem

FileSystem.WatchEventtypeeffect/FileSystem.ts:1308
WatchEvent

Represents file system events emitted when watching files or directories.

When to use

Use when consuming file system watch streams and pattern matching on _tag to handle created, updated, or removed paths.

Details

The union covers create, update, and remove events. Each event carries the reported path.

export type WatchEvent = WatchEvent.Create | WatchEvent.Update | WatchEvent.Remove

/**
 * Namespace containing the concrete event shapes emitted by `FileSystem.watch`.
 *
 * @since 4.0.0
 */
export declare namespace WatchEvent {
  /**
   * Event representing the creation of a new file or directory.
   *
   * **Details**
   *
   * This event is triggered when a new file or directory is created
   * in the watched location.
   *
   * @category models
   * @since 4.0.0
   */
  export interface Create {
    readonly _tag: "Create"
    readonly path: string
  }

  /**
   * Event representing the modification of an existing file or directory.
   *
   * **Details**
   *
   * This event is triggered when an existing file or directory is
   * modified in the watched location.
   *
   * @category models
   * @since 4.0.0
   */
  export interface Update {
    readonly _tag: "Update"
    readonly path: string
  }

  /**
   * Event representing the deletion of a file or directory.
   *
   * **Details**
   *
   * This event is triggered when a file or directory is deleted
   * from the watched location.
   *
   * @category models
   * @since 4.0.0
   */
  export interface Remove {
    readonly _tag: "Remove"
    readonly path: string
  }
}
Referenced by 2 symbols