Skip to content

@pumpkin-plugins/plugin-kit API / data-dir / WasiDataDir

Class: WasiDataDir ​

Defined in: tools/plugin-kit/src/data-dir.ts:15

The plugin's data folder, which the server preopens as data when the plugin may use the filesystem.

Implements ​

Methods ​

[dispose]() ​

[dispose](): void

Defined in: tools/plugin-kit/src/data-dir.ts:21

Releases the root descriptor when the plugin unloads.

Returns ​

void


createDirectory() ​

createDirectory(path): void

Defined in: tools/plugin-kit/src/data-dir.ts:104

Creates a folder and any missing parents. Does nothing if it already exists.

Parameters ​

path ​

string

Returns ​

void

Implementation of ​

DataFiles.createDirectory


list() ​

list(directory): string[]

Defined in: tools/plugin-kit/src/data-dir.ts:62

Names of the entries in a folder.

Parameters ​

directory ​

string

Returns ​

string[]

Implementation of ​

DataFiles.list


open() ​

open(path): RandomAccessFile

Defined in: tools/plugin-kit/src/data-dir.ts:131

Opens a file for random-access reads.

Parameters ​

path ​

string

Returns ​

RandomAccessFile

Implementation of ​

DataFiles.open


readFile() ​

readFile(path): Uint8Array

Defined in: tools/plugin-kit/src/data-dir.ts:81

Reads a whole file.

Parameters ​

path ​

string

Returns ​

Uint8Array

Implementation of ​

DataFiles.readFile


remove() ​

remove(path): void

Defined in: tools/plugin-kit/src/data-dir.ts:119

Deletes a file or an empty folder. Does nothing if it doesn't exist.

Parameters ​

path ​

string

Returns ​

void

Implementation of ​

DataFiles.remove


stat() ​

stat(path): FileInfo | undefined

Defined in: tools/plugin-kit/src/data-dir.ts:41

Describes a path, or returns undefined when nothing is there.

Parameters ​

path ​

string

Returns ​

FileInfo | undefined

Implementation of ​

DataFiles.stat


writeFile() ​

writeFile(path, content): void

Defined in: tools/plugin-kit/src/data-dir.ts:99

Writes a file, replacing any existing one in a single step so readers never see half a file.

Parameters ​

path ​

string

content ​

Uint8Array

Returns ​

void

Implementation of ​

DataFiles.writeFile


open() ​

static open(): WasiDataDir | undefined

Defined in: tools/plugin-kit/src/data-dir.ts:31

Opens the data folder.

Returns ​

WasiDataDir | undefined

The folder, or undefined when the server didn't mount it because fs.*.data isn't granted.

Pumpkin Plugins documentation