@zenfs/dom 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/IndexedDB.d.ts +1 -0
- package/dist/IndexedDB.js +3 -0
- package/dist/Storage.d.ts +1 -0
- package/dist/Storage.js +3 -0
- package/package.json +1 -1
package/dist/IndexedDB.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare class IndexedDBTransaction extends AsyncTransaction<IndexedDBStor
|
|
|
8
8
|
store: IndexedDBStore;
|
|
9
9
|
private _idb;
|
|
10
10
|
constructor(tx: IDBTransaction, store: IndexedDBStore);
|
|
11
|
+
keys(): Promise<Iterable<Ino>>;
|
|
11
12
|
get(key: Ino): Promise<Uint8Array>;
|
|
12
13
|
set(key: Ino, data: Uint8Array): Promise<void>;
|
|
13
14
|
remove(key: Ino): Promise<void>;
|
package/dist/IndexedDB.js
CHANGED
|
@@ -19,6 +19,9 @@ export class IndexedDBTransaction extends AsyncTransaction {
|
|
|
19
19
|
this.store = store;
|
|
20
20
|
this._idb = tx.objectStore(store.name);
|
|
21
21
|
}
|
|
22
|
+
async keys() {
|
|
23
|
+
return (await wrap(this._idb.getAllKeys())).filter(k => typeof k == 'string').map(k => BigInt(k));
|
|
24
|
+
}
|
|
22
25
|
get(key) {
|
|
23
26
|
return wrap(this._idb.get(key.toString()));
|
|
24
27
|
}
|
package/dist/Storage.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare class WebStorageStore implements Store, SimpleSyncStore {
|
|
|
11
11
|
clearSync(): void;
|
|
12
12
|
sync(): Promise<void>;
|
|
13
13
|
transaction(): SimpleTransaction;
|
|
14
|
+
keys(): Iterable<Ino>;
|
|
14
15
|
get(key: Ino): Uint8Array | undefined;
|
|
15
16
|
set(key: Ino, data: Uint8Array): void;
|
|
16
17
|
delete(key: Ino): void;
|
package/dist/Storage.js
CHANGED
|
@@ -20,6 +20,9 @@ export class WebStorageStore {
|
|
|
20
20
|
// No need to differentiate.
|
|
21
21
|
return new SimpleTransaction(this);
|
|
22
22
|
}
|
|
23
|
+
keys() {
|
|
24
|
+
return Object.keys(this.storage).map(k => BigInt(k));
|
|
25
|
+
}
|
|
23
26
|
get(key) {
|
|
24
27
|
const data = this.storage.getItem(key.toString());
|
|
25
28
|
if (typeof data != 'string') {
|