exists
exists: (File) -> booleanWhether a file or directory is there.
File.new(…)
ClientPaths.CLIENT_DIR
ClientPaths.CACHE_DIR| Method | Returns | Description |
|---|---|---|
exists() | boolean | Whether a file or directory is there. |
isFile() | boolean | Whether it is a file. |
isDirectory() | boolean | Whether it is a directory (the plugin's directory always is). |
mkdirs() | boolean | Create the directory and its parents; true when it was created. |
mkdir() | boolean | Create the directory when its parent exists; true when it was created. |
delete() | boolean | Delete the file, or the directory when it is empty; true when it went. |
length() | number | The file's size in bytes, 0 when there is none. |
lastModified() | number | When it last changed, ms since the epoch; 0 when there is none. |
renameTo(File) | boolean | Move the file to dest; true when it moved. |
list() | {string}? | The names directly in this directory, or nil when it is not one. |
listFiles() | {File}? | The files directly in this directory, or nil when it is not one. |
getName() | string | The last component (.bentobox for the plugin's directory). |
getPath() | string | The path as text, .bentobox\.... |
getParent() | string? | The parent's path as text, or nil for the plugin's directory. |
getParentFile() | File? | The parent, or nil for the plugin's directory. |
equals(any) | boolean | Whether obj is a File of the same path. |
toString() | string | The path as text, .bentobox\.... |
readText() | string | The whole file as text (UTF-8, a byte order mark dropped). A missing file is FileNotFoundException. |
writeText(string) | () | Replace the file with text (UTF-8) at once, atomically, under the plugin's quota; parent directories are made. |
readBytes() | string | The whole file's bytes, as a Luau string (any bytes). A missing file is FileNotFoundException. |
writeBytes(string) | () | Replace the file with bytes (a Luau string, any bytes) at once, atomically, under the plugin's quota; parent directories are made. |
new(File?, string) | File | (File?, string) -> File: child inside parent (nil parent: child alone). |
new(string) | File | |
new(string?, string) | File |
| Method | Returns | Description |
|---|---|---|
FileClass.new | File | (File?, string) -> File: child inside parent (nil parent: child alone). |
existsexists: (File) -> booleanWhether a file or directory is there.
isFileisFile: (File) -> booleanWhether it is a file.
isDirectoryisDirectory: (File) -> booleanWhether it is a directory (the plugin's directory always is).
mkdirsmkdirs: (File) -> booleanCreate the directory and its parents; true when it was created.
mkdirmkdir: (File) -> booleanCreate the directory when its parent exists; true when it was created.
deletedelete: (File) -> booleanDelete the file, or the directory when it is empty; true when it went.
lengthlength: (File) -> numberThe file's size in bytes, 0 when there is none.
lastModifiedlastModified: (File) -> numberWhen it last changed, ms since the epoch; 0 when there is none.
renameTorenameTo: (File, File) -> booleanMove the file to dest; true when it moved.
listlist: (File) -> {string}?The names directly in this directory, or nil when it is not one.
listFileslistFiles: (File) -> {File}?The files directly in this directory, or nil when it is not one.
getNamegetName: (File) -> stringThe last component (.bentobox for the plugin's directory).
getPathgetPath: (File) -> stringThe path as text, .bentobox\....
getParentgetParent: (File) -> string?The parent's path as text, or nil for the plugin's directory.
getParentFilegetParentFile: (File) -> File?The parent, or nil for the plugin's directory.
equalsequals: (File, any) -> booleanWhether obj is a File of the same path.
toStringtoString: (File) -> stringThe path as text, .bentobox\....
readTextreadText: (File) -> stringThe whole file as text (UTF-8, a byte order mark dropped). A missing file is FileNotFoundException.
writeTextwriteText: (File, string) -> ()Replace the file with text (UTF-8) at once, atomically, under the plugin's quota; parent directories are made.
readBytesreadBytes: (File) -> stringThe whole file's bytes, as a Luau string (any bytes). A missing file is FileNotFoundException.
writeByteswriteBytes: (File, string) -> ()Replace the file with bytes (a Luau string, any bytes) at once, atomically, under the plugin's quota; parent directories are made.
newnew: ((File?, string) -> File) & ((string) -> File) & ((string?, string) -> File)(File?, string) -> File: child inside parent (nil parent: child alone).
(string) -> File: The file at pathname, relative to the plugin's directory (/ or \; a .bentobox\... text a File printed is accepted).
(string?, string) -> File: child inside the directory parent names.