filesystem.open
Synopsis
local fs = require "filesystem"
fs.open(path: fs.path, flags: string[][, mode: integer]) -> file_descriptor
Description
Open the file using the specified path.
The implementation for this function always include the flag O_NOCTTY
behind
the scenes.
flags
may contain:
"append"
-
Open the file in append mode.
"create"
-
Create the file if it does not exist.
"directory"
-
Fail if
path
resolves to a non-directory file. "exclusive"
-
Ensure a new file is created. Must be combined with create.
"no_follow"
-
Fail if
path
resolves to a symbolic link. "path"
-
Get a stable reference to an inode without actually opening the contents.
"read_only"
-
Open the file for reading.
"read_write"
-
Open the file for reading and writing.
"sync_all_on_write"
-
Open the file so that write operations automatically synchronise the file data and metadata to disk (
FILE_FLAG_WRITE_THROUGH
/O_SYNC
). "temporary"
-
Create an unnamed temporary regular file.
"truncate"
-
Open the file with any existing contents truncated.
"write_only"
-
Open the file for writing.
Not available on Windows. |