Skip to content

@pumpkin-plugins/plugin-kit API / testing/memory-files / MemoryFiles

Class: MemoryFiles ​

Defined in: tools/plugin-kit/src/testing/memory-files.ts:4

An in-memory data folder that counts reads, so tests can check what gets re-read.

Implements ​

Properties ​

reads ​

readonly reads: Map<string, number>

Defined in: tools/plugin-kit/src/testing/memory-files.ts:8

How many times each file was read in full.

Methods ​

createDirectory() ​

createDirectory(path): void

Defined in: tools/plugin-kit/src/testing/memory-files.ts:63

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/testing/memory-files.ts:40

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/testing/memory-files.ts:72

Opens a file for random-access reads.

Parameters ​

path ​

string

Returns ​

RandomAccessFile

Implementation of ​

DataFiles.open


put() ​

put(path, content): this

Defined in: tools/plugin-kit/src/testing/memory-files.ts:12

Adds or replaces a file, bumping its modification time.

Parameters ​

path ​

string

content ​

string | Uint8Array<ArrayBufferLike>

Returns ​

this


readFile() ​

readFile(path): Uint8Array

Defined in: tools/plugin-kit/src/testing/memory-files.ts:51

Reads a whole file.

Parameters ​

path ​

string

Returns ​

Uint8Array

Implementation of ​

DataFiles.readFile


remove() ​

remove(path): void

Defined in: tools/plugin-kit/src/testing/memory-files.ts:21

Deletes a file or a folder.

Parameters ​

path ​

string

Returns ​

void

Implementation of ​

DataFiles.remove


stat() ​

stat(path): FileInfo | undefined

Defined in: tools/plugin-kit/src/testing/memory-files.ts:34

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

Parameters ​

path ​

string

Returns ​

FileInfo | undefined

Implementation of ​

DataFiles.stat


text() ​

text(path): string | undefined

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

Text of a file, for assertions.

Parameters ​

path ​

string

Returns ​

string | undefined


writeFile() ​

writeFile(path, content): void

Defined in: tools/plugin-kit/src/testing/memory-files.ts:58

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

Pumpkin Plugins documentation