Skip to content

StorageManager ​

@vimp-mp/types 2.0.1

Interface · Client API

Persistent JSON storage scoped to the current server.

ts
interface StorageManager

Members ​

clear ​

ts
clear(prefix?: string): number

Removes all keys, or only keys that start with prefix. Returns the removed count.

getItem ​

ts
getItem<T = unknown>(key: string): T | null

Returns null when the key is missing. Saved null also reads as null; use hasItem to distinguish those states.

hasItem ​

ts
hasItem(key: string): boolean

Reports whether the current server namespace contains key.

keys ​

ts
keys(prefix?: string): Array<string>

Returns all keys, or only keys that start with prefix.

removeItem ​

ts
removeItem(key: string): boolean

Removes one key. Returns true only when a value was removed.

setItem ​

ts
setItem<T>(key: string, value: T): void

Persists a JSON-serializable value in the current server namespace.

VIMP developer documentation