@hashtree/dexie 0.1.1 → 0.1.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/README.md +49 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @hashtree/dexie
|
|
2
|
+
|
|
3
|
+
IndexedDB storage adapter for hashtree using Dexie.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @hashtree/dexie
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { DexieStore } from '@hashtree/dexie';
|
|
15
|
+
import { HashTree } from '@hashtree/core';
|
|
16
|
+
|
|
17
|
+
const store = new DexieStore('my-hashtree-db');
|
|
18
|
+
const tree = new HashTree({ store });
|
|
19
|
+
|
|
20
|
+
// Store persists to IndexedDB
|
|
21
|
+
await tree.putFile(data);
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- Persistent browser storage
|
|
27
|
+
- LRU eviction support
|
|
28
|
+
- Automatic schema migrations
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
const store = new DexieStore(dbName?: string);
|
|
34
|
+
|
|
35
|
+
await store.get(hash);
|
|
36
|
+
await store.put(hash, data);
|
|
37
|
+
await store.has(hash);
|
|
38
|
+
await store.delete(hash);
|
|
39
|
+
await store.keys();
|
|
40
|
+
await store.clear();
|
|
41
|
+
await store.count();
|
|
42
|
+
await store.totalBytes();
|
|
43
|
+
await store.evict(maxBytes);
|
|
44
|
+
store.close();
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashtree/dexie",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Dexie-based IndexedDB store for hashtree",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"dexie": "^4.2.1",
|
|
30
|
-
"@hashtree/core": "0.1.
|
|
30
|
+
"@hashtree/core": "0.1.3"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"typescript": "^5.3.0",
|