Skip to content

@pumpkin-plugins/plugin-kit API / files / DataFiles

Interface: DataFiles ​

Defined in: tools/plugin-kit/src/files.ts:25

The plugin's private data folder. Every path is relative to it and uses / separators.

Methods ​

createDirectory() ​

createDirectory(path): void

Defined in: tools/plugin-kit/src/files.ts:35

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

Parameters ​

path ​

string

Returns ​

void


list() ​

list(directory): string[]

Defined in: tools/plugin-kit/src/files.ts:29

Names of the entries in a folder.

Parameters ​

directory ​

string

Returns ​

string[]


open() ​

open(path): RandomAccessFile

Defined in: tools/plugin-kit/src/files.ts:39

Opens a file for random-access reads.

Parameters ​

path ​

string

Returns ​

RandomAccessFile


readFile() ​

readFile(path): Uint8Array

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

Reads a whole file.

Parameters ​

path ​

string

Returns ​

Uint8Array


remove() ​

remove(path): void

Defined in: tools/plugin-kit/src/files.ts:37

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

Parameters ​

path ​

string

Returns ​

void


stat() ​

stat(path): FileInfo | undefined

Defined in: tools/plugin-kit/src/files.ts:27

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

Parameters ​

path ​

string

Returns ​

FileInfo | undefined


writeFile() ​

writeFile(path, content): void

Defined in: tools/plugin-kit/src/files.ts:33

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

Pumpkin Plugins documentation