Skip to content

CopyOnWriteFS

Defined in: src/backends/cow.ts:131

Internal

Using a readable file system as a base, writes are done to a writable file system.

new CopyOnWriteFS(readable, writable, journal?): CopyOnWriteFS

Defined in: src/backends/cow.ts:142

FileSystem

The file system that initially populates this file system.

FileSystem

The file system to write modified files to.

Journal = ...

The journal to use for persisting deletions

CopyOnWriteFS

FileSystem.constructor

protected optional _mountPoint?: string

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

Internal

The last place this file system was mounted

FileSystem._mountPoint


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

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

Internal

The UUID of the file system.

FileSystem._uuid


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

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

FileSystemAttributes

IndexFS.attributes


protected inos: Map<string, number>

Defined in: src/backends/cow.ts:172

Inode numbers presented to the VFS for each path.

The readable and writable layers allocate inode numbers independently, so they can collide. They can not be used as-is, since the VFS uses ino to tell files apart. This also keeps a file’s inode number stable when it is copied up to the writable layer.


readonly journal: Journal

Defined in: src/backends/cow.ts:150

The journal to use for persisting deletions


optional label?: string

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

FileSystem.label


readonly name: string

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

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

IndexFS.name


readonly readable: FileSystem

Defined in: src/backends/cow.ts:144

The file system that initially populates this file system.


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

IndexFS.type


readonly writable: FileSystem

Defined in: src/backends/cow.ts:147

The file system to write modified files to.

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

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

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

FileSystem.uuid

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

Defined in: src/backends/cow.ts:302

Create the file at path with the given options.

string

CreationOptions

Promise<InodeLike<number>>

FileSystem.createFile


createFileSync(path, options): InodeLike

Defined in: src/backends/cow.ts:309

Create the file at path with the given options.

string

CreationOptions

InodeLike

FileSystem.createFileSync


exists(path): Promise<boolean>

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

Test whether or not path exists.

string

Promise<boolean>

FileSystem.exists


existsSync(path): boolean

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

Test whether or not path exists.

string

boolean

FileSystem.existsSync


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

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

Internal

IoctlContext

number

any[]

Promise<any>

FileSystem.ioctl


ioctlSync(context, command, …args): any

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

Internal

IoctlContext

number

any[]

any

FileSystem.ioctlSync


isDeleted(path): boolean

Defined in: src/backends/cow.ts:161

string

boolean


link(srcpath, dstpath): Promise<void>

Defined in: src/backends/cow.ts:316

string

string

Promise<void>

FileSystem.link


linkSync(srcpath, dstpath): void

Defined in: src/backends/cow.ts:322

string

string

void

FileSystem.linkSync


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

Defined in: src/backends/cow.ts:388

string

CreationOptions

Promise<InodeLike<number>>

FileSystem.mkdir


mkdirSync(path, options): InodeLike

Defined in: src/backends/cow.ts:396

string

CreationOptions

InodeLike

FileSystem.mkdirSync


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

Defined in: src/backends/cow.ts:224

Reads into a buffer

string

Uint8Array

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

number

number

The position in the file to stop reading

Promise<void>

FileSystem.read


readdir(path): Promise<string[]>

Defined in: src/backends/cow.ts:404

string

Promise<string[]>

FileSystem.readdir


readdirSync(path): string[]

Defined in: src/backends/cow.ts:422

string

string[]

FileSystem.readdirSync


readSync(path, buffer, offset, end): void

Defined in: src/backends/cow.ts:230

Reads into a buffer

string

Uint8Array

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

number

number

The position in the file to stop reading

void

FileSystem.readSync


ready(): Promise<void>

Defined in: src/backends/cow.ts:132

Promise<void>

FileSystem.ready


readySync(): void

Defined in: src/backends/cow.ts:137

void

FileSystem.readySync


protected remapIno(path, inode): InodeLike

Defined in: src/backends/cow.ts:196

Replaces the layer’s inode number with the public one for path

string

InodeLike

InodeLike


rename(oldPath, newPath): Promise<void>

Defined in: src/backends/cow.ts:244

string

string

Promise<void>

FileSystem.rename


protected renameInos(oldPath, newPath): void

Defined in: src/backends/cow.ts:176

Moves the public inode numbers for a rename, including a directory’s descendants

string

string

void


renameSync(oldPath, newPath): void

Defined in: src/backends/cow.ts:259

string

string

void

FileSystem.renameSync


rmdir(path): Promise<void>

Defined in: src/backends/cow.ts:358

string

Promise<void>

FileSystem.rmdir


rmdirSync(path): void

Defined in: src/backends/cow.ts:373

string

void

FileSystem.rmdirSync


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

Defined in: src/backends/cow.ts:274

string

Promise<InodeLike<number>>

FileSystem.stat


statSync(path): InodeLike

Defined in: src/backends/cow.ts:283

string

InodeLike

FileSystem.statSync


streamRead(path, options): ReadableStream

Defined in: src/backends/cow.ts:452

Read a file using a stream.

string

StreamOptions

ReadableStream

FileSystem.streamRead


streamWrite(path, options): WritableStream

Defined in: src/backends/cow.ts:456

Write a file using stream.

string

StreamOptions

WritableStream

FileSystem.streamWrite


sync(): Promise<void>

Defined in: src/backends/cow.ts:216

Promise<void>

FileSystem.sync


syncSync(): void

Defined in: src/backends/cow.ts:220

void

FileSystem.syncSync


toString(): string

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

string

FileSystem.toString


touch(path, metadata): Promise<void>

Defined in: src/backends/cow.ts:292

Modify metadata.

string

InodeLike

Promise<void>

FileSystem.touch


touchSync(path, metadata): void

Defined in: src/backends/cow.ts:297

Modify metadata.

string

InodeLike

void

FileSystem.touchSync


unlink(path): Promise<void>

Defined in: src/backends/cow.ts:328

string

Promise<void>

FileSystem.unlink


unlinkSync(path): void

Defined in: src/backends/cow.ts:343

string

void

FileSystem.unlinkSync


usage(): UsageInfo

Defined in: src/backends/cow.ts:212

UsageInfo

Consider trying to track information on the writable as well

FileSystem.usage


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

Defined in: src/backends/cow.ts:234

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>

FileSystem.write


writeSync(path, buffer, offset): void

Defined in: src/backends/cow.ts:239

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

FileSystem.writeSync