Name | Type |
---|---|
T |
extends IBasicRecord |
- defaultKey
- encoder
- handles
- holesIndex
- keys
- lastIndex
- order
- recordsIndex
- recordsRoot
- root
- tableName
- trees
- cleanupHole
- createOrFindHandle
- decodeLocation
- delete
- drop
- encodeLocation
- getHole
- import
- init
- insert
- query
- read
- readFile
- readMany
- unload
- writeFile
• new OPFSDB<T
>(tableName
, keys?
, order?
, defaultKey?
): OPFSDB
<T
>
Name | Type |
---|---|
T |
extends IBasicRecord |
Name | Type | Default value |
---|---|---|
tableName |
string |
undefined |
keys? |
ITableKeys |
undefined |
order |
number |
25 |
defaultKey |
undefined | string |
undefined |
OPFSDB
<T
>
• Private
defaultKey: undefined
| string
• Private
encoder: IEncoder
• Private
handles: Map
<FileSystemDirectoryHandle
, Map
<string
, FileSystemSyncAccessHandle
>>
• Private
holesIndex: BPTreeAsync
<number
, number
>
• Private
Optional
keys: ITableKeys
• Private
lastIndex: number
• Private
order: number
= 25
• Private
recordsIndex: BPTreeAsync
<Uint8Array
, string
>
• Private
recordsRoot: FileSystemDirectoryHandle
• Private
root: FileSystemDirectoryHandle
• Private
tableName: string
• Private
trees: Record
<string
, BPTreeAsync
<string
, string
| number
>> = {}
▸ cleanupHole(hole
, encodedLength
, encodedEndIndex
): Promise
<void
>
Name | Type |
---|---|
hole |
void | [number , number ] |
encodedLength |
number |
encodedEndIndex |
number |
Promise
<void
>
▸ createOrFindHandle(dir
, fileName
, create?
): Promise
<FileSystemSyncAccessHandle
>
Name | Type | Default value |
---|---|---|
dir |
FileSystemDirectoryHandle |
undefined |
fileName |
string |
undefined |
create |
boolean |
false |
Promise
<FileSystemSyncAccessHandle
>
▸ decodeLocation(val?
): number
[]
Name | Type |
---|---|
val? |
Uint8Array |
number
[]
▸ delete(id
, oldRecord?
): Promise
<void
>
Name | Type |
---|---|
id |
string |
oldRecord? |
T |
Promise
<void
>
▸ drop(): Promise
<void
>
Promise
<void
>
▸ encodeLocation(at
, length
): Uint8Array
Name | Type |
---|---|
at |
number |
length |
number |
Uint8Array
▸ getHole(size
): Promise
<void
| [number
, number
]>
Name | Type |
---|---|
size |
number |
Promise
<void
| [number
, number
]>
▸ import(records
): Promise
<void
>
Name | Type |
---|---|
records |
{ id : string ; value : T }[] |
Promise
<void
>
▸ init(): Promise
<void
>
Promise
<void
>
▸ insert(id
, value
, fullRecord?
): Promise
<void
>
Name | Type |
---|---|
id |
string |
value |
T |
fullRecord? |
boolean |
Promise
<void
>
▸ query(queries
, options?
): Promise
<string
[] | T
[]>
Name | Type |
---|---|
queries |
{ [key in string | number | symbol]?: Partial<Object> } |
options? |
IQueryOptions |
Promise
<string
[] | T
[]>
▸ read(id
): Promise
<void
| T
>
Name | Type |
---|---|
id |
string |
Promise
<void
| T
>
▸ readFile(dir
, fileName
, from?
, encoder?
, to?
): Promise
<any
>
Name | Type | Default value |
---|---|---|
dir |
FileSystemDirectoryHandle |
undefined |
fileName |
string |
undefined |
from |
number |
0 |
encoder? |
false | IEncoder |
undefined |
to? |
number |
undefined |
Promise
<any
>
▸ readMany(ids
): Promise
<T
[]>
Name | Type |
---|---|
ids |
string [] |
Promise
<T
[]>
▸ unload(): void
void
▸ writeFile(dir
, fileName
, data
, encoder?
, at?
, pageSize?
): Promise
<void
>
Name | Type | Default value |
---|---|---|
dir |
FileSystemDirectoryHandle |
undefined |
fileName |
string |
undefined |
data |
Record <string , any > | Uint8Array |
undefined |
encoder? |
false | IEncoder |
undefined |
at |
number |
0 |
pageSize? |
number |
undefined |
Promise
<void
>