LocalStorage class


A basic storage plugin that stores data to the local file system.

Signature:

export declare class LocalStorage implements IStorage 

Implements: IStorage

References: IStorage


Constructor

new LocalStorage (client: Client, root: string)

Constructs a new instance of the LocalStorage class.

Parameters:

ParameterTypeDescription
clientClientThe client to use.
rootStringThe root path to use.

Methods

.fetch ()

Fetches a value from storage.

Signature:

fetch<T>(key: string, id: string): Promise<T>;

Parameters:

ParameterTypeDescription
keyStringThe path to the value to fetch.
idStringThe file name of the value to fetch.

Return type: Promise < T >


.remove ()

Deletes a value from storage.

Signature:

remove(key: string, id: string): void;

Parameters:

ParameterTypeDescription
keyStringThe path to the value to delete.
idStringThe file name of the value to delete.

Return type: void


.save ()

Saves a value to storage.

Signature:

save<T>(value: T, key: string, id: string): Promise<T>;

Parameters:

ParameterTypeDescription
valueTThe value to save.
keyStringThe path to the value to save.
idStringThe file name of the value to save.

Return type: Promise < T >


Signature:

search<T>(key: string, query: {        [key: string]: any;    }): Promise<T[]>;

Parameters:

ParameterTypeDescription
keyString
query{ key: string: any; }

Return type: Promise < T >


Table of Contents