@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
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
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
Implementation of
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
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
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
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
open()
staticopen():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.