This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
component:filesystem:zh [2023/10/26 03:16] hfsr created |
component:filesystem:zh [2023/12/10 16:22] (current) hfsr [组件:文件系统] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | Component: Filesystem | + | 组件:文件系统 |
===================== | ===================== | ||
- | This component is provided by [[item:floppy_disk|Floppy Disks]] or [[item:hard_disk_drive|Hard Disk Drives]] in Managed mode (for Unmanaged mode, see [[drive|Drive]]) | + | 此组件由处于管理模式的[[item:floppy_disk:zh|软盘]]或[[item:hard_disk_drive:zh|硬盘驱动器]]提供。(对于非管理模式,请参见[[component:drive:zh|驱动器]]组件) |
- | + | ||
- | Component name: `filesystem`. | + | 组件名:`filesystem`。 |
- | Callbacks: | + | |
+ | 回调函数: | ||
- `spaceUsed():number` | - `spaceUsed():number` | ||
- | The currently used capacity of the file system, in bytes. | + | 返回当前文件系统的已用容量,单位为字节。 |
+ | \\ | ||
- `open(path:string[, mode:string='r']):number` | - `open(path:string[, mode:string='r']):number` | ||
- | Opens a new file descriptor and returns its handle. | + | 打开一个新的文件描述符,并返回其句柄。 |
+ | \\ | ||
- `seek(handle:number, whence:string, offset:number):number` | - `seek(handle:number, whence:string, offset:number):number` | ||
- | Seeks in an open file descriptor with the specified handle. Returns the new pointer position. | + | 在指定的已打开文件描述符中移动操作位置。返回新的指针位置。 |
+ | \\ | ||
- `makeDirectory(path:string):boolean` | - `makeDirectory(path:string):boolean` | ||
- | Creates a directory at the specified absolute path in the file system. Creates parent directories, if necessary. | + | 在文件系统的给定绝对路径处创建一个新目录。若必要的话创建其各级父目录。 |
+ | \\ | ||
- `exists(path:string):boolean` | - `exists(path:string):boolean` | ||
- | Returns whether an object exists at the specified absolute path in the file system. | + | 返回文件系统中给定绝对路径指向的对象是否存在 。 |
+ | \\ | ||
- `isReadOnly():boolean` | - `isReadOnly():boolean` | ||
- | Returns whether the file system is read-only. | + | 返回文件系统是否只读。 |
+ | \\ | ||
- `write(handle:number, value:string):boolean` | - `write(handle:number, value:string):boolean` | ||
- | Writes the specified data to an open file descriptor with the specified handle. | + | 将给定数据写入到给定句柄对应的文件描述符中。 |
+ | \\ | ||
- `spaceTotal():number` | - `spaceTotal():number` | ||
- | The overall capacity of the file system, in bytes. | + | 返回文件系统的总容量,单位为字节。 |
+ | \\ | ||
- `isDirectory(path:string):boolean` | - `isDirectory(path:string):boolean` | ||
- | Returns whether the object at the specified absolute path in the file system is a directory. | + | 返回文件系统中给定绝对路径指向的对象是否为目录 。 |
+ | \\ | ||
- `rename(from:string, to:string):boolean` | - `rename(from:string, to:string):boolean` | ||
- | Renames/moves an object from the first specified absolute path in the file system to the second. | + | 将文件系统中第一个给定绝对路径指向的对象重命名/移动为第二个。 |
+ | \\ | ||
- `list(path:string):table` | - `list(path:string):table` | ||
- | Returns a list of names of objects in the directory at the specified absolute path in the file system. | + | 返回文件系统中给定绝对路径指向的目录下的对象名列表。 |
+ | \\ | ||
- `lastModified(path:string):number` | - `lastModified(path:string):number` | ||
- | Returns the (real world) timestamp of when the object at the specified absolute path in the file system was modified. | + | 返回文件系统中给定绝对路径指向的对象上次修改时的(现实世界)时间戳。 |
+ | \\ | ||
- `getLabel():string` | - `getLabel():string` | ||
- | Get the current label of the file system. | + | 获取文件系统的当前标签。 |
+ | \\ | ||
- `remove(path:string):boolean` | - `remove(path:string):boolean` | ||
- | Removes the object at the specified absolute path in the file system. | + | 删除文件系统中给定绝对路径指向的对象。 |
+ | \\ | ||
- `close(handle:number)` | - `close(handle:number)` | ||
- | Closes an open file descriptor with the specified handle. | + | 关闭给定句柄对应的文件描述符。 |
+ | \\ | ||
- `size(path:string):number` | - `size(path:string):number` | ||
- | Returns the size of the object at the specified absolute path in the file system. | + | 返回文件系统中给定绝对路径指向的对象的大小。 |
+ | \\ | ||
- `read(handle:number, count:number):string or nil` | - `read(handle:number, count:number):string or nil` | ||
- | Reads up to the specified amount of data from an open file descriptor with the specified handle. Returns nil when EOF is reached. | + | 从指定句柄对应的文件描述符中读取最多指定大小的数据。若到达`EOF`则返回`nil`。 |
+ | \\ | ||
- `setLabel(value:string):string` | - `setLabel(value:string):string` | ||
- | Sets the label of the file system. Returns the new value, which may be truncated. | + | 设定文件系统的标签。返回新的标签值,可能为截短形式。 |
目录 | 目录 |