@citadeldb/wasm 2.0.0 → 2.1.0

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 CHANGED
@@ -10,7 +10,7 @@ Every page is encrypted at rest with AES-256-CTR + HMAC-SHA256. Runs entirely in
10
10
  npm install @citadeldb/wasm
11
11
  ```
12
12
 
13
- ## Usage
13
+ ## Browser usage
14
14
 
15
15
  ```js
16
16
  import init, { CitadelDb } from "@citadeldb/wasm";
@@ -53,6 +53,21 @@ const stats = db.stats();
53
53
  db.free();
54
54
  ```
55
55
 
56
+ ## Node.js initialization
57
+
58
+ The web-target package must receive the Wasm bytes explicitly in Node.js because Node does not fetch `file:` URLs.
59
+
60
+ ```js
61
+ import { readFile } from "node:fs/promises";
62
+ import init, { CitadelDb } from "@citadeldb/wasm";
63
+
64
+ const entry = import.meta.resolve("@citadeldb/wasm");
65
+ const wasmUrl = new URL("./citadel_wasm_bg.wasm", entry);
66
+ await init({ module_or_path: await readFile(wasmUrl) });
67
+
68
+ const db = new CitadelDb("my-passphrase");
69
+ ```
70
+
56
71
  ## API
57
72
 
58
73
  | Method | Description |
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@citadeldb/wasm",
3
3
  "type": "module",
4
4
  "description": "WASM bindings for Citadel encrypted database",
5
- "version": "2.0.0",
5
+ "version": "2.1.0",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",