Skip to main content Link Menu Expand (external link) Document Search Copy Copied

FileSystem overview

Added in v0.6.0


Table of contents


constructors

File

By default files are readonly (overwrite = false).

Signature

export declare const File: (path: string, content: string, overwrite?: boolean) => File

Added in v0.6.0

instances

FileSystem

Signature

export declare const FileSystem: FileSystem

Added in v0.6.0

model

File (interface)

Represents a file which can be optionally overwriteable.

Signature

export interface File {
  readonly path: string
  readonly content: string
  readonly overwrite: boolean
}

Added in v0.6.0

FileSystem (interface)

Represents operations that can be performed on a file system.

Signature

export interface FileSystem {
  readonly readFile: (path: string) => TE.TaskEither<string, string>
  /**
   * If the parent directory does not exist, it's created.
   */
  readonly writeFile: (path: string, content: string) => TE.TaskEither<string, void>
  readonly exists: (path: string) => TE.TaskEither<string, boolean>
  /**
   * Removes a file or directory based upon the specified pattern. The directory can have contents.
   * If the path does not exist, silently does nothing.
   */
  readonly remove: (pattern: string) => TE.TaskEither<string, void>
  /**
   * Searches for files matching the specified glob pattern.
   */
  readonly search: (pattern: string, exclude: ReadonlyArray<string>) => TE.TaskEither<string, ReadonlyArray<string>>
}

Added in v0.6.0