Skip to main content
Module

x/gauntlet/mod.ts>VirtualFileSystem

Work-in-progress front-end tool which does put a smile on my face
Latest
class VirtualFileSystem
Re-export
import { VirtualFileSystem } from "https://deno.land/x/gauntlet@v0.0.9/mod.ts";

Type Parameters

optional
T = any

Properties

protected
contents: Map<string, Item<T>>
protected
CWD: string
protected
root: string
add
readonly
size: number

Methods

private
_exists(existingPath: string)

Low-level path existence checking implementation, given path must be absolute.

private
_lstat(existingPath: string): WalkEntry

Low-level folder creation implementation, given path must be absolute and valid, implying all parent folders exist.

private
_mkdir(existingPath: string)

Low-level folder creation implementation, given path must be absolute and valid, implying all parent folders exist.

private
_move(entry: Item<T>, to: string)

Low-level item moving implementation, destination path must be absolute and not be already registered in contents.

cd(path: string): void
cwd(): string
exists(path: string): Promise<boolean>
existsSync(path: string)
filter(fn: (res: T, path: string) => boolean)
getChildNames(path: string): string[]
getChildPaths(path: string): string[]
getPaths(): string[]
getRoot(): string[]
lstat(givenPath: string)
lstatSync(givenPath: string)
map<R = T>(fn: (res: T, path: string) => R)
mkdir(givenPath: string)
mkdirSync(givenPath: string)
move(from: string, to: string)
moveSync(from: string, to: string)
read(path: string)
readFile(path: string)
readFileSync(path: string)
readSync(path: string)
readTextFile(path: string)
readTextFileSync(path: string): string
remove(path: string)
removeSync(givenPath: string)
rename(from: string, to: string)
renameSync(from: string, to: string)

Rename synchronously a file or a directory. This method is almost the same as moveSync except the destination cannot be an existing entry, nor the root folder.

resolve(p: string)
traverse(givenPath: string): IterableIterator<PathItem>

Given an absolute path, split it and returns an iterator, for each folder. This utility doesn't check if these folders actually exist.

walk(givenPath: string)
walkSync(givenPath: string)
watch(paths: string | string[]): AsyncPushIterator<FsEvent>
write(givenPath: string, value: T)
writeFile(path: string, data: Uint8Array)
writeFileSync(path: string, data: Uint8Array)
writeSync(givenPath: string, value: T)
writeTextFile(path: string, data: string)
writeTextFileSync(path: string, data: string)