FS API
|
|||||||||||
Concatenates path pathA with path pathB, such that pathB appears after pathA. A naïve implementation of this function would be pathA .. "/" .. pathB . fs.combine should always be preferred over such a pattern, as this function will take care of special cases, such as when pathB starts with a forward slash, and typeA ends with a forward slash. The naïve implementation would generate three forward slashes between the paths. |
|||||||||||
Syntax | fs.combine(
|
||||||||||
Returns | string | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | fs | ||||||||||
|
Fs.complete
|
|||||||||||
Copies the file at the path path to the path dest. If dest is a directory, the function will copy the file into that directory with its original name. | |||||||||||
Syntax | fs.copy(
|
||||||||||
Returns | nil | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | fs | ||||||||||
| |||||||||||
|
|
|||||||||||
Deletes the file or directory at the path path. If path is a directory, it will delete the directory as well as all the files inside.
|
|||||||||||
Syntax | fs.delete(
|
||||||||||
Returns | nil | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | fs | ||||||||||
| |||||||||||
|
|
|||||||||||
Returns true if a file or directory exists at path path, otherwise returns false . |
|||||||||||
Syntax | fs.exists(
|
||||||||||
Returns | boolean | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | fs | ||||||||||
|
|
|||||||||||
Returns a table containing all files and folders that match a wildcard expansion search. | |||||||||||
Syntax | fs.find(
|
||||||||||
Returns | table | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | fs | ||||||||||
|
|
|||||||||||
Returns the directory part of a file. | |||||||||||
Syntax | fs.getDir(
|
||||||||||
Returns | string | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | fs | ||||||||||
|
|
|||||||||||
Returns the type of the medium, where the data is stored. Returns nil, if the path doesn't exists. | |||||||||||
Syntax | fs.getDrive(
|
||||||||||
Returns | string medium | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | fs | ||||||||||
|
|
|||||||||||
Returns the free space in a directory in bytes. | |||||||||||
Syntax | fs.getFreeSpace(
|
||||||||||
Returns | number space | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | fs | ||||||||||
|
|
|||||||||||
Returns the filename part of a path. | |||||||||||
Syntax | fs.getName(
|
||||||||||
Returns | string | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | fs | ||||||||||
|
|
|||||||||||
Returns the size of a file in Bytes. Returns 0 if path is a directory. | |||||||||||
Syntax | fs.getSize(
|
||||||||||
Returns | number | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | fs | ||||||||||
|
|
|||||||||||
Returns true if a directory exists at path path. Returns false if path path is a file, or if it does not exist. |
|||||||||||
Syntax | fs.isDir(
|
||||||||||
Returns | boolean | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | fs | ||||||||||
|
|
|||||||||||
Returns true if the file or directory at path path is read-only, meaning files cannot be created or changed there. Returns false if the path path is writable, or if it does not exist. /rom is an example of a read-only mount – you cannot create your own files there, or change files there. |
|||||||||||
Syntax | fs.isReadOnly(
|
||||||||||
Returns | boolean | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | fs | ||||||||||
|
|
|||||||||||
Returns a table of all the files/directories in the directory at the path path. | |||||||||||
Syntax | fs.list(
|
||||||||||
Returns | table | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | fs | ||||||||||
|
|
|||||||||||
Creates the directory at the path path. If a file or directory at path path already exists, the function will error with File exists . |
|||||||||||
Syntax | fs.makeDir(
|
||||||||||
Returns | nil | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | fs | ||||||||||
|
|
|||||||||
Moves the file at the path path to the path dest. This is effectively equivalent to renaming the file.
The function will create any directories necessary, meaning you can move a file to |
|||||||||
Syntax | fs.move(
|
||||||||
Returns | nil | ||||||||
Part of | CC:Tweaked (source) | ||||||||
API | fs | ||||||||
|
|
|||||||||||
Opens a file for reading, writing, or appending. Writing to a file that does not exist creates the file. Mode Must be either w (writing), a (appending), or r (reading) | |||||||||||
Syntax | fs.open(
|
||||||||||
Returns | Input Handler (w/a) Output Handler (r) | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | fs | ||||||||||
| |||||||||||
| |||||||||||
|
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.