Skip to content

Commit

Permalink
Merge pull request #106 from GuoXiCheng/dev-c
Browse files Browse the repository at this point in the history
update file-system
  • Loading branch information
GuoXiCheng authored Jul 29, 2024
2 parents 4005121 + 74356f7 commit 7a6d1cc
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 4 deletions.
25 changes: 25 additions & 0 deletions src/.vitepress/sidebars/nodejs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,31 @@
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/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

13 changes: 13 additions & 0 deletions src/backend/nodejs/file-system/directory-operation.md
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions src/backend/nodejs/file-system/file-operation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 18 additions & 0 deletions src/backend/nodejs/file-system/file-status.md
Original file line number Diff line number Diff line change
@@ -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 | 判断是否为目录 |
13 changes: 13 additions & 0 deletions src/backend/nodejs/file-system/stream-operation.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7a6d1cc

Please sign in to comment.