Skip to content

FileSystem

Defined in: src/internal/filesystem.ts:155

Internal

Provides a consistent and easy to use internal API. Default implementations for exists and existsSync are included. If you are extending this class, note that every path is an absolute path and all arguments are present.

new FileSystem(type, name): FileSystem

Defined in: src/internal/filesystem.ts:180

number

A unique ID for this kind of file system. Currently unused internally, but could be used for partition tables or something

string

The name for this file system. For example, tmpfs for an in memory one

FileSystem

protected optional _mountPoint?: string

Defined in: src/internal/filesystem.ts:162

Internal

The last place this file system was mounted


protected _uuid: `${string}-${string}-${string}-${string}-${string}`

Defined in: src/internal/filesystem.ts:169

Internal

The UUID of the file system.


readonly attributes: ConstMap<FileSystemAttributes, keyof FileSystemAttributes, void | CaseFold | undefined> & Map<string, any>

Defined in: src/internal/filesystem.ts:178

FileSystemAttributes


optional label?: string

Defined in: src/internal/filesystem.ts:156


readonly name: string

Defined in: src/internal/filesystem.ts:191

The name for this file system. For example, tmpfs for an in memory one


readonly type: number

Defined in: src/internal/filesystem.ts:185

A unique ID for this kind of file system. Currently unused internally, but could be used for partition tables or something

get uuid(): `${string}-${string}-${string}-${string}-${string}`

Defined in: src/internal/filesystem.ts:171

`${string}-${string}-${string}-${string}-${string}`

abstract createFile(path, options): Promise<InodeLike<number>>

Defined in: src/internal/filesystem.ts:233

Create the file at path with the given options.

string

CreationOptions

Promise<InodeLike<number>>


abstract createFileSync(path, options): InodeLike

Defined in: src/internal/filesystem.ts:238

Create the file at path with the given options.

string

CreationOptions

InodeLike


exists(path): Promise<boolean>

Defined in: src/internal/filesystem.ts:257

Test whether or not path exists.

string

Promise<boolean>


existsSync(path): boolean

Defined in: src/internal/filesystem.ts:269

Test whether or not path exists.

string

boolean


ioctl(context, command, …args): Promise<any>

Defined in: src/internal/filesystem.ts:359

Internal

IoctlContext

number

any[]

Promise<any>


ioctlSync(context, command, …args): any

Defined in: src/internal/filesystem.ts:367

Internal

IoctlContext

number

any[]

any


abstract link(target, link): Promise<void>

Defined in: src/internal/filesystem.ts:278

string

string

Promise<void>


abstract linkSync(target, link): void

Defined in: src/internal/filesystem.ts:279

string

string

void


abstract mkdir(path, options): Promise<InodeLike<number>>

Defined in: src/internal/filesystem.ts:248

string

CreationOptions

Promise<InodeLike<number>>


abstract mkdirSync(path, options): InodeLike

Defined in: src/internal/filesystem.ts:249

string

CreationOptions

InodeLike


abstract read(path, buffer, start, end): Promise<void>

Defined in: src/internal/filesystem.ts:290

Reads into a buffer

string

Uint8Array

The buffer to read into. You must set the byteOffset and byteLength appropriately!

number

The offset into the file to start reading from

number

The position in the file to stop reading

Promise<void>


abstract readdir(path): Promise<string[]>

Defined in: src/internal/filesystem.ts:251

string

Promise<string[]>


abstract readdirSync(path): string[]

Defined in: src/internal/filesystem.ts:252

string

string[]


abstract readSync(path, buffer, start, end): void

Defined in: src/internal/filesystem.ts:297

Reads into a buffer

string

Uint8Array

The buffer to read into. You must set the byteOffset and byteLength appropriately!

number

The offset into the file to start reading from

number

The position in the file to stop reading

void


ready(): Promise<void>

Defined in: src/internal/filesystem.ts:213

Promise<void>


readySync(): void

Defined in: src/internal/filesystem.ts:214

void


abstract rename(oldPath, newPath): Promise<void>

Defined in: src/internal/filesystem.ts:218

string

string

Promise<void>


abstract renameSync(oldPath, newPath): void

Defined in: src/internal/filesystem.ts:219

string

string

void


abstract rmdir(path): Promise<void>

Defined in: src/internal/filesystem.ts:245

string

Promise<void>


abstract rmdirSync(path): void

Defined in: src/internal/filesystem.ts:246

string

void


abstract stat(path): Promise<InodeLike<number>>

Defined in: src/internal/filesystem.ts:221

string

Promise<InodeLike<number>>


abstract statSync(path): InodeLike

Defined in: src/internal/filesystem.ts:222

string

InodeLike


streamRead(path, options): ReadableStream

Defined in: src/internal/filesystem.ts:317

Read a file using a stream.

string

StreamOptions

ReadableStream


streamWrite(path, options): WritableStream

Defined in: src/internal/filesystem.ts:340

Write a file using stream.

string

StreamOptions

WritableStream


abstract sync(): Promise<void>

Defined in: src/internal/filesystem.ts:281

Promise<void>


abstract syncSync(): void

Defined in: src/internal/filesystem.ts:282

void


toString(): string

Defined in: src/internal/filesystem.ts:197

string


abstract touch(path, metadata): Promise<void>

Defined in: src/internal/filesystem.ts:225

Modify metadata.

string

Partial<InodeLike>

Promise<void>


abstract touchSync(path, metadata): void

Defined in: src/internal/filesystem.ts:228

Modify metadata.

string

Partial<InodeLike>

void


abstract unlink(path): Promise<void>

Defined in: src/internal/filesystem.ts:240

string

Promise<void>


abstract unlinkSync(path): void

Defined in: src/internal/filesystem.ts:241

string

void


usage(): UsageInfo

Defined in: src/internal/filesystem.ts:206

Default implementation.

UsageInfo

Implement


abstract write(path, buffer, offset): Promise<void>

Defined in: src/internal/filesystem.ts:304

Writes a buffer to a file

string

Uint8Array

The buffer to write. You must set the byteOffset and byteLength appropriately!

number

The offset in the file to start writing

Promise<void>


abstract writeSync(path, buffer, offset): void

Defined in: src/internal/filesystem.ts:311

Writes a buffer to a file

string

Uint8Array

The buffer to write. You must set the byteOffset and byteLength appropriately!

number

The offset in the file to start writing

void