vvvfs 0.1.3 → 0.1.5

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
@@ -86,7 +86,16 @@ const vvvfs = new VVVFS("vvvfs", {
86
86
 
87
87
  ## 更新日志
88
88
 
89
+ ### 0.1.5
90
+
91
+ - 重新 `lock` 和 `unlock` 方法
92
+
93
+ ### 0.1.4
94
+
95
+ - 使用 AI 优化代码
96
+
89
97
  ### 0.1.3
98
+
90
99
  - 新增 `lock` 和 `unlock` 方法,可以锁定文件,防止其他代码访问该文件
91
100
 
92
101
  ### 0.1.2
package/index.html CHANGED
@@ -9,37 +9,7 @@
9
9
  </head>
10
10
 
11
11
  <body>
12
- <script>
13
- (async () => {
14
- try {
15
- globalThis.vvvfs = new VVVFS();
16
- vvvfs.options.throwError = true;
17
- await vvvfs.reset();
18
- await vvvfs.init("IFTC");
19
- console.log(vvvfs);
20
- vvvfs.watch("/test.txt", (type) => {
21
- console.log(type);
22
- // return true;
23
- });
24
- console.log("创建文件", await vvvfs.createFile("/test.txt"));
25
- console.log("写入文件", await vvvfs.writeText("/test.txt", "Hello World"));
26
- console.log("追加文件", await vvvfs.appendText("/test.txt", " - Appended"));
27
- // await vvvfs.lock("/test.txt");
28
- console.log("文件是否存在", await vvvfs.exists("/test.txt"));
29
- console.log("文件是否存在", await vvvfs.exists("/test2.txt"));
30
- console.log("读取文件", await vvvfs.readText("/test.txt"));
31
- console.log("读取文件块", await vvvfs.readTextChunk("/test.txt", 0, 5));
32
- console.log("复制文件", await vvvfs.copy("/test.txt", "/test2.txt"));
33
- console.log("搜索文件", await vvvfs.search("/", "t"));
34
- console.log("移动文件", await vvvfs.move("/test2.txt", "/test3.txt"));
35
- console.log("删除文件", await vvvfs.delete("/test.txt"));
36
- const file = new VVVFS.File("test.txt");
37
- console.log("写入文件", await file.writeText("Hello World"));
38
- } catch (error) {
39
- console.error(error);
40
- }
41
- })();
42
- </script>
12
+ <script src="index.js"></script>
43
13
  </body>
44
14
 
45
15
  </html>
package/index.js ADDED
@@ -0,0 +1,34 @@
1
+ /// <reference path="./types/index.d.ts" />
2
+ /**
3
+ * @class VVVFS
4
+ * @description VVVFS 虚拟文件系统
5
+ */
6
+ (async () => {
7
+ try {
8
+ globalThis.vvvfs = new VVVFS();
9
+ vvvfs.options.throwError = true;
10
+ await vvvfs.reset();
11
+ await vvvfs.init("IFTC");
12
+ console.log(vvvfs);
13
+ vvvfs.watch("/test.txt", (type) => {
14
+ console.log(type);
15
+ // return true;
16
+ });
17
+ console.log("创建文件", await vvvfs.createFile("/test.txt"));
18
+ console.log("写入文件", await vvvfs.writeText("/test.txt", "Hello World"));
19
+ console.log("追加文件", await vvvfs.appendText("/test.txt", " - Appended"));
20
+ // await vvvfs.lock("/test.txt");
21
+ console.log("文件是否存在", await vvvfs.exists("/test.txt"));
22
+ console.log("文件是否存在", await vvvfs.exists("/test2.txt"));
23
+ console.log("读取文件", await vvvfs.readText("/test.txt"));
24
+ console.log("读取文件块", await vvvfs.readTextChunk("/test.txt", 0, 5));
25
+ console.log("复制文件", await vvvfs.copy("/test.txt", "/test2.txt"));
26
+ console.log("搜索文件", await vvvfs.search("/", "t"));
27
+ console.log("移动文件", await vvvfs.move("/test2.txt", "/test3.txt"));
28
+ console.log("删除文件", await vvvfs.delete("/test.txt"));
29
+ const file = new VVVFS.File("test.txt");
30
+ console.log("写入文件", await file.writeText("Hello World"));
31
+ } catch (error) {
32
+ console.error(error);
33
+ }
34
+ })();