2022-02-25 22:00:39 +00:00
|
|
|
--- @meta
|
|
|
|
|
|
|
|
local fs = {}
|
|
|
|
|
2023-12-26 03:08:29 +00:00
|
|
|
--- Returns an absolute version of the `path`.
|
|
|
|
--- This can be used to resolve short paths like `..` to `/home/user`.
|
2022-04-23 04:01:54 +00:00
|
|
|
function fs.abs(path) end
|
|
|
|
|
2023-12-26 03:08:29 +00:00
|
|
|
--- Returns the "basename," or the last part of the provided `path`. If path is empty,
|
|
|
|
--- `.` will be returned.
|
2022-12-15 04:00:54 +00:00
|
|
|
function fs.basename(path) end
|
2022-06-20 20:47:56 +00:00
|
|
|
|
2023-12-26 03:08:29 +00:00
|
|
|
--- Changes Hilbish's directory to `dir`.
|
2022-02-25 22:15:49 +00:00
|
|
|
function fs.cd(dir) end
|
2022-02-25 22:00:39 +00:00
|
|
|
|
2023-12-26 03:08:29 +00:00
|
|
|
--- Returns the directory part of `path`. If a file path like
|
|
|
|
--- `~/Documents/doc.txt` then this function will return `~/Documents`.
|
2022-12-15 04:00:54 +00:00
|
|
|
function fs.dir(path) end
|
2022-06-20 20:47:56 +00:00
|
|
|
|
2023-12-26 03:08:29 +00:00
|
|
|
--- Match all files based on the provided `pattern`.
|
|
|
|
--- For the syntax' refer to Go's filepath.Match function: https://pkg.go.dev/path/filepath#Match
|
|
|
|
---
|
|
|
|
---
|
2022-12-15 04:00:54 +00:00
|
|
|
function fs.glob(pattern) end
|
2022-06-20 20:47:56 +00:00
|
|
|
|
2023-12-26 03:08:29 +00:00
|
|
|
--- Takes any list of paths and joins them based on the operating system's path separator.
|
|
|
|
---
|
|
|
|
---
|
|
|
|
function fs.join(...path) end
|
2022-07-13 19:46:40 +00:00
|
|
|
|
2023-12-26 03:08:29 +00:00
|
|
|
--- Creates a new directory with the provided `name`.
|
|
|
|
--- With `recursive`, mkdir will create parent directories.
|
|
|
|
---
|
|
|
|
---
|
2022-02-25 22:15:49 +00:00
|
|
|
function fs.mkdir(name, recursive) end
|
2022-02-25 22:00:39 +00:00
|
|
|
|
2024-04-28 00:38:12 +00:00
|
|
|
--- Returns a pair of connected files, also known as a pipe.
|
|
|
|
--- The type returned is a Lua file, same as returned from `io` functions.
|
|
|
|
function fs.fpipe() end
|
|
|
|
|
2023-12-26 03:08:29 +00:00
|
|
|
--- Returns a list of all files and directories in the provided path.
|
|
|
|
function fs.readdir(path) end
|
2022-02-25 22:00:39 +00:00
|
|
|
|
2023-12-26 03:08:29 +00:00
|
|
|
--- Returns the information about a given `path`.
|
|
|
|
--- The returned table contains the following values:
|
2022-12-21 00:59:55 +00:00
|
|
|
--- name (string) - Name of the path
|
2023-12-26 03:08:29 +00:00
|
|
|
--- size (number) - Size of the path in bytes
|
|
|
|
--- mode (string) - Unix permission mode in an octal format string (with leading 0)
|
2022-12-21 00:59:55 +00:00
|
|
|
--- isDir (boolean) - If the path is a directory
|
2023-12-26 03:08:29 +00:00
|
|
|
---
|
|
|
|
---
|
2022-02-25 22:15:49 +00:00
|
|
|
function fs.stat(path) end
|
2022-02-25 22:00:39 +00:00
|
|
|
|
|
|
|
return fs
|