Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ts_morph/common/mod.ts>FileSystemHost

TypeScript Compiler API wrapper for static analysis and programmatic code changes.
Very Popular
Go to Latest
interface FileSystemHost
import { type FileSystemHost } from "https://deno.land/x/ts_morph@18.0.0/common/mod.ts";

Represents a file system that can be interacted with.

Methods

isCaseSensitive(): boolean

Gets if this file system is case sensitive.

delete(path: string): Promise<void>

Asynchronously deletes the specified file or directory.

deleteSync(path: string): void

Synchronously deletes the specified file or directory

readDirSync(dirPath: string): RuntimeDirEntry[]

Reads all the child directories and files.

readFile(filePath: string, encoding?: string): Promise<string>

Asynchronously reads a file at the specified path.

readFileSync(filePath: string, encoding?: string): string

Synchronously reads a file at the specified path.

writeFile(filePath: string, fileText: string): Promise<void>

Asynchronously writes a file to the file system.

writeFileSync(filePath: string, fileText: string): void

Synchronously writes a file to the file system.

mkdir(dirPath: string): Promise<void>

Asynchronously creates a directory at the specified path.

mkdirSync(dirPath: string): void

Synchronously creates a directory at the specified path.

move(srcPath: string, destPath: string): Promise<void>

Asynchronously moves a file or directory.

moveSync(srcPath: string, destPath: string): void

Synchronously moves a file or directory.

copy(srcPath: string, destPath: string): Promise<void>

Asynchronously copies a file or directory.

copySync(srcPath: string, destPath: string): void

Synchronously copies a file or directory.

fileExists(filePath: string): Promise<boolean>

Asynchronously checks if a file exists.

fileExistsSync(filePath: string): boolean

Synchronously checks if a file exists.

directoryExists(dirPath: string): Promise<boolean>

Asynchronously checks if a directory exists.

directoryExistsSync(dirPath: string): boolean

Synchronously checks if a directory exists.

getCurrentDirectory(): string

Gets the current directory of the environment.

glob(patterns: ReadonlyArray<string>): Promise<string[]>

Uses pattern matching to find files or directories.

globSync(patterns: ReadonlyArray<string>): string[]

Synchronously uses pattern matching to find files or directories.