@filebox/core 1.0.11 → 1.0.12

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
@@ -1,49 +1,49 @@
1
- # @filebox/core
2
-
3
- FileBox 的虚拟文件系统核心包,用来把不同存储驱动挂载到统一的路径空间里,并通过同一套 API 读写文件。
4
-
5
- ## 安装
6
-
7
- ```bash
8
- pnpm add @filebox/core
9
- ```
10
-
11
- ## 使用
12
-
13
- ```ts
14
- import FileBox from "@filebox/core";
15
- import WebDAVDriver from "./drivers/webdav";
16
-
17
- FileBox.use({
18
- name: "webdav",
19
- package: WebDAVDriver,
20
- });
21
-
22
- const filebox = new FileBox();
23
-
24
- await filebox.mount({
25
- name: "/dav",
26
- provider: "webdav",
27
- rootPath: "/",
28
- auth: {
29
- url: "https://example.com/dav/",
30
- username: "user",
31
- password: "password",
32
- },
33
- });
34
-
35
- const list = await filebox.list("/dav");
36
- const stat = await filebox.stat("/dav/readme.txt");
37
- ```
38
-
39
- 常用 API:
40
-
41
- - `mount(options)`:挂载一个驱动到指定路径。
42
- - `unmount(path)`:卸载已挂载的路径。
43
- - `list(path)`:读取目录。
44
- - `stat(path)`:读取文件或目录信息。
45
- - `mkdir(path, name)`、`upload(path, file)`、`remove(path)`、`rename(path, name)`:常见文件操作。
46
-
47
- ## License
48
-
49
- MIT
1
+ # @filebox/core
2
+
3
+ FileBox 的虚拟文件系统核心包,用来把不同存储驱动挂载到统一的路径空间里,并通过同一套 API 读写文件。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ pnpm add @filebox/core
9
+ ```
10
+
11
+ ## 使用
12
+
13
+ ```ts
14
+ import FileBox from "@filebox/core";
15
+ import WebDAVDriver from "./drivers/webdav";
16
+
17
+ FileBox.use({
18
+ name: "webdav",
19
+ package: WebDAVDriver,
20
+ });
21
+
22
+ const filebox = new FileBox();
23
+
24
+ await filebox.mount({
25
+ name: "/dav",
26
+ provider: "webdav",
27
+ rootPath: "/",
28
+ auth: {
29
+ url: "https://example.com/dav/",
30
+ username: "user",
31
+ password: "password",
32
+ },
33
+ });
34
+
35
+ const list = await filebox.list("/dav");
36
+ const stat = await filebox.stat("/dav/readme.txt");
37
+ ```
38
+
39
+ 常用 API:
40
+
41
+ - `mount(options)`:挂载一个驱动到指定路径。
42
+ - `unmount(path)`:卸载已挂载的路径。
43
+ - `list(path)`:读取目录。
44
+ - `stat(path)`:读取文件或目录信息。
45
+ - `mkdir(path, name)`、`upload(path, file)`、`remove(path)`、`rename(path, name)`:常见文件操作。
46
+
47
+ ## License
48
+
49
+ MIT