AIDC Toolkit / Core / ReadOnlyAppDataStorage
Abstract Class: ReadOnlyAppDataStorage<SupportsBinary>
Defined in: app-data-storage.ts:7
Generic read-only application data storage.
Extended by
Type Parameters
SupportsBinary
SupportsBinary extends boolean
Properties
BINARY_EXTENSION
protectedreadonlystaticBINARY_EXTENSION:".bin"=".bin"
Defined in: app-data-storage.ts:11
Extension to identify binary data.
JSON_EXTENSION
protectedreadonlystaticJSON_EXTENSION:".json"=".json"
Defined in: app-data-storage.ts:16
Extension to identify JSON data.
Constructors
Constructor
protectednew ReadOnlyAppDataStorage<SupportsBinary>(supportsBinary,path?):ReadOnlyAppDataStorage<SupportsBinary>
Defined in: app-data-storage.ts:37
Constructor.
Parameters
supportsBinary
SupportsBinary
True if binary data is supported.
path?
string
Storage path prepended to each key along with '/' if defined, empty string if not.
Returns
ReadOnlyAppDataStorage<SupportsBinary>
Accessors
supportsBinary
Get Signature
get supportsBinary():
SupportsBinary
Defined in: app-data-storage.ts:45
Determine if binary data is supported.
Returns
SupportsBinary
path
Get Signature
get path():
string
Defined in: app-data-storage.ts:52
Get the storage path, prepended to each key.
Returns
string
Methods
fullKey()
protectedfullKey(pathKey,isBinary):string
Defined in: app-data-storage.ts:68
Build the full storage key.
Parameters
pathKey
string
Key relative to path.
isBinary
boolean
True if key is to binary data, false or undefined if to string data. Ignored if binary data is not supported.
Returns
string
Full storage key.
doRead()
abstractprotecteddoRead(key,asBinary):Promisable<SupportsBinaryextendstrue?string|Uint8Array<ArrayBufferLike> :string|undefined>
Defined in: app-data-storage.ts:90
Read a string or binary data from persistent storage.
Parameters
key
string
Storage key (file path in Node.js, key in localStorage).
asBinary
True if binary data is requested, false or undefined if string data is requested. Ignored if binary data is not supported.
boolean | undefined
Returns
Promisable<SupportsBinary extends true ? string | Uint8Array<ArrayBufferLike> : string | undefined>
String or binary data or undefined if not found.
read()
Defined in: app-data-storage.ts:105
Read application data from storage.
Parameters
pathKey
string
Key relative to path.
asBinary?
boolean
True if binary data is requested, false or undefined if string data is requested. Ignored if binary data is not supported.
Returns
Application data or undefined if not found.