Skip to content

PortFS

Defined in: src/backends/port.ts:39

Internal

PortFS lets you access an FS instance that is running in a port, or the other way around.

Note that direct synchronous operations are not permitted on the PortFS, regardless of the configuration option of the remote FS.

T extends Channel = Channel

new PortFS<T>(channel, timeout?): PortFS<T>

Defined in: src/backends/port.ts:50

Constructs a new PortFS instance that connects with the FS running on options.port.

T

number = 250

PortFS<T>

Async(FileSystem).constructor

protected optional _mountPoint?: string

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

Internal

The last place this file system was mounted

Async(FileSystem)._mountPoint


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

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

Internal

The UUID of the file system.

Async(FileSystem)._uuid


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

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

FileSystemAttributes

Async(FileSystem).attributes


readonly channel: T

Defined in: src/backends/port.ts:51


optional label?: string

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

Async(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

Async(FileSystem).name


readonly port: Port<T>

Defined in: src/backends/port.ts:40


readonly timeout: number = 250

Defined in: src/backends/port.ts:52


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

Async(FileSystem).type

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

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

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

Async(FileSystem).uuid

createFile(path, options): Promise<Inode>

Defined in: src/backends/port.ts:91

Create the file at path with the given options.

string

CreationOptions

Promise<Inode>

Async(FileSystem).createFile


abstract createFileSync(path, options): InodeLike

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

Create the file at path with the given options.

string

CreationOptions

InodeLike

FileSystem.createFileSync


exists(path): Promise<boolean>

Defined in: src/backends/port.ts:115

Test whether or not path exists.

string

Promise<boolean>

Async(FileSystem).exists


existsSync(path): boolean

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

Test whether or not path exists.

string

boolean

Async(FileSystem).existsSync


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

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

Internal

IoctlContext

number

any[]

Promise<any>

Async(FileSystem).ioctl


ioctlSync(context, command, …args): any

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

Internal

IoctlContext

number

any[]

any

FileSystem.ioctlSync


link(srcpath, dstpath): Promise<void>

Defined in: src/backends/port.ts:119

string

string

Promise<void>

Async(FileSystem).link


abstract linkSync(target, link): void

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

string

string

void

FileSystem.linkSync


mkdir(path, options): Promise<Inode>

Defined in: src/backends/port.ts:105

string

CreationOptions

Promise<Inode>

Async(FileSystem).mkdir


abstract mkdirSync(path, options): InodeLike

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

string

CreationOptions

InodeLike

FileSystem.mkdirSync


queueDone(): Promise<void>

Defined in: src/mixins/async.ts:31

Promise<void>

Async(FileSystem).queueDone


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

Defined in: src/backends/port.ts:123

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>

Async(FileSystem).read


readdir(path): Promise<string[]>

Defined in: src/backends/port.ts:111

string

Promise<string[]>

Async(FileSystem).readdir


abstract readdirSync(path): string[]

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

string

string[]

FileSystem.readdirSync


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

FileSystem.readSync


ready(): Promise<void>

Defined in: src/backends/port.ts:67

Promise<void>

AsyncMixin.ready


readySync(): void

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

void

FileSystem.readySync


rename(oldPath, newPath): Promise<void>

Defined in: src/backends/port.ts:72

string

string

Promise<void>

Async(FileSystem).rename


abstract renameSync(oldPath, newPath): void

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

string

string

void

FileSystem.renameSync


rmdir(path): Promise<void>

Defined in: src/backends/port.ts:101

string

Promise<void>

Async(FileSystem).rmdir


abstract rmdirSync(path): void

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

string

void

FileSystem.rmdirSync


protected rpc<T>(method, …args): Promise<Awaited<ReturnType<Methods[T]>>>

Defined in: src/backends/port.ts:59

T extends keyof Methods

T

Parameters<Methods[T]>

Promise<Awaited<ReturnType<Methods[T]>>>


stat(path): Promise<Inode>

Defined in: src/backends/port.ts:76

string

Promise<Inode>

Async(FileSystem).stat


abstract statSync(path): InodeLike

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

string

InodeLike

FileSystem.statSync


streamRead(path, options): ReadableStream

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

Read a file using a stream.

string

StreamOptions

ReadableStream

Async(FileSystem).streamRead


streamWrite(path, options): WritableStream

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

Write a file using stream.

string

StreamOptions

WritableStream

Async(FileSystem).streamWrite


sync(): Promise<void>

Defined in: src/backends/port.ts:86

Promise<void>

AsyncMixin.sync


abstract syncSync(): void

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

void

FileSystem.syncSync


toString(): string

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

string

Async(FileSystem).toString


touch(path, metadata): Promise<void>

Defined in: src/backends/port.ts:81

Modify metadata.

string

InodeLike<number> | Inode

Promise<void>

Async(FileSystem).touch


abstract touchSync(path, metadata): void

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

Modify metadata.

string

Partial<InodeLike>

void

FileSystem.touchSync


unlink(path): Promise<void>

Defined in: src/backends/port.ts:97

string

Promise<void>

Async(FileSystem).unlink


abstract unlinkSync(path): void

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

string

void

FileSystem.unlinkSync


usage(): UsageInfo

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

Default implementation.

UsageInfo

Implement

Async(FileSystem).usage


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

Defined in: src/backends/port.ts:127

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>

Async(FileSystem).write


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

FileSystem.writeSync