From 9b1a1b1b4d441388ebe586f6288afc52207b770b Mon Sep 17 00:00:00 2001 From: Xicheng Guo Date: Mon, 29 Jul 2024 12:08:39 +0800 Subject: [PATCH 1/2] update file-system --- src/.vitepress/sidebars/nodejs.yaml | 16 ++++++++++++++++ .../nodejs/file-system/directory-operation.md | 13 +++++++++++++ .../nodejs/file-system/file-operation.md | 8 ++++---- src/backend/nodejs/file-system/file-status.md | 18 ++++++++++++++++++ 4 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 src/backend/nodejs/file-system/directory-operation.md create mode 100644 src/backend/nodejs/file-system/file-status.md diff --git a/src/.vitepress/sidebars/nodejs.yaml b/src/.vitepress/sidebars/nodejs.yaml index d9e3b87..70c0c4c 100644 --- a/src/.vitepress/sidebars/nodejs.yaml +++ b/src/.vitepress/sidebars/nodejs.yaml @@ -27,6 +27,22 @@ link: /backend/nodejs/file-system/file-operation#文件追加 - text: 文件删除 link: /backend/nodejs/file-system/file-operation#文件删除 + - text: 目录操作 + link: /backend/nodejs/file-system/directory-operation + items: + - text: 创建目录 + link: /backend/nodejs/file-system/directory-operation#创建目录 + - text: 读取目录 + link: /backend/nodejs/file-system/directory-operation#读取目录 + - text: 删除目录 + link: /backend/nodejs/file-system/directory-operation#删除目录 + - text: 文件状态 + link: /backend/nodejs/file-system/file-status + items: + - text: 获取文件状态 + link: /backend/nodejs/file-system/file-status#获取文件状态 + - text: 文件状态对象 + link: /backend/nodejs/file-system/file-status#文件状态对象 - text: 文件系统标志 link: /backend/nodejs/file-system/file-system-flag \ No newline at end of file diff --git a/src/backend/nodejs/file-system/directory-operation.md b/src/backend/nodejs/file-system/directory-operation.md new file mode 100644 index 0000000..abfaca8 --- /dev/null +++ b/src/backend/nodejs/file-system/directory-operation.md @@ -0,0 +1,13 @@ +# 目录操作 + +## 创建目录 + +<<< @/../projects/javascript-sandbox/src/file-system/directory-mkdir.ts#mkdir + +## 读取目录 + +<<< @/../projects/javascript-sandbox/src/file-system/directory-readdir.ts#readdir + +## 删除目录 + +<<< @/../projects/javascript-sandbox/src/file-system/directory-rmdir.ts#rmdir diff --git a/src/backend/nodejs/file-system/file-operation.md b/src/backend/nodejs/file-system/file-operation.md index 5ae8e4f..a227754 100644 --- a/src/backend/nodejs/file-system/file-operation.md +++ b/src/backend/nodejs/file-system/file-operation.md @@ -2,16 +2,16 @@ ## 文件读取 -<<< @/../projects/javascript-sandbox/src/file-system/file-operation.ts#read +<<< @/../projects/javascript-sandbox/src/file-system/file-read.ts#read ## 文件写入 -<<< @/../projects/javascript-sandbox/src/file-system/file-operation.ts#write +<<< @/../projects/javascript-sandbox/src/file-system/file-write.ts#write ## 文件追加 -<<< @/../projects/javascript-sandbox/src/file-system/file-operation.ts#append +<<< @/../projects/javascript-sandbox/src/file-system/file-append.ts#append ## 文件删除 -<<< @/../projects/javascript-sandbox/src/file-system/file-operation.ts#unlink +<<< @/../projects/javascript-sandbox/src/file-system/file-unlink.ts#unlink diff --git a/src/backend/nodejs/file-system/file-status.md b/src/backend/nodejs/file-system/file-status.md new file mode 100644 index 0000000..ea1b063 --- /dev/null +++ b/src/backend/nodejs/file-system/file-status.md @@ -0,0 +1,18 @@ +# 文件状态 + +## 获取文件状态 + +<<< @/../projects/javascript-sandbox/src/file-system/stat.ts#stat + +## 文件状态对象 + +| 属性/方法 | 返回值类型 | 描述 | +| --------------- | ---------- | --------------------- | +| `size` | number | 获取文件大小(bytes) | +| `mode` | number | 获取文件权限 | +| `atime` | Date | 获取文件访问时间 | +| `mtime` | Date | 获取文件修改时间 | +| `ctime` | Date | 获取文件状态改变时间 | +| `birthtime` | Date | 获取文件创建时间 | +| `isFile()` | boolean | 判断是否为文件 | +| `isDirectory()` | boolean | 判断是否为目录 | From 74356f7772791fc3087156b731504e6f39bb7cc0 Mon Sep 17 00:00:00 2001 From: Xicheng Guo Date: Mon, 29 Jul 2024 16:16:55 +0800 Subject: [PATCH 2/2] update file-system --- src/.vitepress/sidebars/nodejs.yaml | 9 +++++++++ src/backend/nodejs/file-system/stream-operation.md | 13 +++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/backend/nodejs/file-system/stream-operation.md diff --git a/src/.vitepress/sidebars/nodejs.yaml b/src/.vitepress/sidebars/nodejs.yaml index 70c0c4c..7c79052 100644 --- a/src/.vitepress/sidebars/nodejs.yaml +++ b/src/.vitepress/sidebars/nodejs.yaml @@ -43,6 +43,15 @@ link: /backend/nodejs/file-system/file-status#获取文件状态 - text: 文件状态对象 link: /backend/nodejs/file-system/file-status#文件状态对象 + - text: 流操作 + link: /backend/nodejs/file-system/stream-operation + items: + - text: 读取流 + link: /backend/nodejs/file-system/stream-operation#读取流 + - text: 写入流 + link: /backend/nodejs/file-system/stream-operation#写入流 + - text: 管道流 + link: /backend/nodejs/file-system/stream-operation#管道流 - text: 文件系统标志 link: /backend/nodejs/file-system/file-system-flag \ No newline at end of file diff --git a/src/backend/nodejs/file-system/stream-operation.md b/src/backend/nodejs/file-system/stream-operation.md new file mode 100644 index 0000000..5c0bece --- /dev/null +++ b/src/backend/nodejs/file-system/stream-operation.md @@ -0,0 +1,13 @@ +# 流操作 + +## 读取流 + +<<< @/../projects/javascript-sandbox/src/file-system/stream-read.ts + +## 写入流 + +<<< @/../projects/javascript-sandbox/src/file-system/stream-write.ts + +## 管道流 + +<<< @/../projects/javascript-sandbox/src/file-system/stream-pipe.ts