@pagepocket/uni-fs 0.4.0 → 0.4.1

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.
Files changed (2) hide show
  1. package/README.md +27 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # @pagepocket/uni-fs
2
+
3
+ Unified filesystem helpers that work in Node and OPFS (Origin Private File System).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @pagepocket/uni-fs
9
+ ```
10
+
11
+ ## API
12
+
13
+ ```ts
14
+ import { write, readAsURL, readText, readBinary, exists, delete as deleteFile } from "@pagepocket/uni-fs";
15
+
16
+ await write("snapshots/page", "html", "<html>...</html>");
17
+ const url = await readAsURL("snapshots/page", "html");
18
+ const text = await readText("snapshots/page", "html");
19
+ const bytes = await readBinary("snapshots/page", "html");
20
+ const ok = await exists("snapshots/page", "html");
21
+ await deleteFile("snapshots/page", "html");
22
+ ```
23
+
24
+ ## Behavior
25
+
26
+ - In browsers/Service Workers with OPFS, `readAsURL` returns a `data:` URL.
27
+ - In Node, `readAsURL` returns a file path beginning with `/`.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pagepocket/uni-fs",
3
- "version": "0.4.0",
4
- "description": "",
3
+ "version": "0.4.1",
4
+ "description": "Unified filesystem helpers for Node and OPFS environments.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",