@zturnlibs/ztron-api


stronghold

Classes

Stronghold

Defined in: stronghold.ts:50

每保险库句柄(上游 Stronghold 对象精神):绑定路径,密码在会话期随实例保存。

Properties

path

readonly path: string

Defined in: stronghold.ts:52

Methods

clear()

clear(): Promise<void>

Defined in: stronghold.ts:76

Returns

Promise<void>

close()

close(): Promise<StrongholdStatus>

Defined in: stronghold.ts:86

脏则冲刷,并忘记密码。

Returns

Promise<StrongholdStatus>

get()

get<T>(key): Promise<T | null>

Defined in: stronghold.ts:61

Type Parameters
T

T = unknown

Parameters
key

string

Returns

Promise<T | null>

has()

has(key): Promise<boolean>

Defined in: stronghold.ts:67

Parameters
key

string

Returns

Promise<boolean>

keys()

keys(): Promise<string[]>

Defined in: stronghold.ts:73

Returns

Promise<string[]>

reload()

reload(): Promise<StrongholdStatus>

Defined in: stronghold.ts:90

丢弃未保存状态并从磁盘重新打开。

Returns

Promise<StrongholdStatus>

remove()

remove(key): Promise<void>

Defined in: stronghold.ts:70

Parameters
key

string

Returns

Promise<void>

save()

save(): Promise<StrongholdStatus>

Defined in: stronghold.ts:79

Returns

Promise<StrongholdStatus>

saveTo()

saveTo(newPath): Promise<StrongholdStatus>

Defined in: stronghold.ts:82

Parameters
newPath

string

Returns

Promise<StrongholdStatus>

set()

set(key, value): Promise<void>

Defined in: stronghold.ts:64

Parameters
key

string

value

unknown

Returns

Promise<void>

load()

static load(path, password): Promise<Stronghold>

Defined in: stronghold.ts:56

Parameters
path

string

password

string

Returns

Promise<Stronghold>

Interfaces

StrongholdStatus

Defined in: stronghold.ts:4

Properties

closed?

optional closed?: boolean

Defined in: stronghold.ts:8

entries?

optional entries?: number

Defined in: stronghold.ts:5

path?

optional path?: string

Defined in: stronghold.ts:6

reloaded?

optional reloaded?: boolean

Defined in: stronghold.ts:9

saved?

optional saved?: boolean

Defined in: stronghold.ts:7

Variables

stronghold

const stronghold: object

Defined in: stronghold.ts:95

Type Declaration

clear

clear: (path) => Promise<void>

Parameters
path

string

Returns

Promise<void>

close

close: (path) => Promise<StrongholdStatus>

Parameters
path

string

Returns

Promise<StrongholdStatus>

get

get: <T>(path, key) => Promise<T | null>

Type Parameters
T

T = unknown

Parameters
path

string

key

string

Returns

Promise<T | null>

has

has: (path, key) => Promise<boolean>

Parameters
path

string

key

string

Returns

Promise<boolean>

keys

keys: (path) => Promise<string[]>

Parameters
path

string

Returns

Promise<string[]>

load

load: (path, password) => Promise<StrongholdStatus>

Parameters
path

string

password

string

Returns

Promise<StrongholdStatus>

reload

reload: (path, password) => Promise<StrongholdStatus>

Parameters
path

string

password

string

Returns

Promise<StrongholdStatus>

remove

remove: (path, key) => Promise<void>

Parameters
path

string

key

string

Returns

Promise<void>

save

save: (path) => Promise<StrongholdStatus>

Parameters
path

string

Returns

Promise<StrongholdStatus>

saveTo

saveTo: (path, newPath) => Promise<StrongholdStatus>

Parameters
path

string

newPath

string

Returns

Promise<StrongholdStatus>

set

set: (path, key, value) => Promise<void>

Parameters
path

string

key

string

value

unknown

Returns

Promise<void>

Functions

load()

load(path, password): Promise<StrongholdStatus>

Defined in: stronghold.ts:12

Parameters

path

string

password

string

Returns

Promise<StrongholdStatus>