Enumeration of possible flags for opening file.

The exclusive flag 'x' (O_EXCL flag in open(2)) ensures that path is newly created. On POSIX systems, path is considered to exist even if it is a symlink to a non-existent file. The exclusive flag may or may not work with network file systems.

On Linux, positional writes don't work when the file is opened in append mode. The kernel ignores the position argument and always appends the data to the end of the file.

Static variables

@:value(cast "ax")@:impl@:enumstaticinlineread onlyAppendCheck:FsOpenFlag = "ax"

Like AppendCreate but fails if path exists.

@:value(cast "a")@:impl@:enumstaticinlineread onlyAppendCreate:FsOpenFlag = "a"

Open file for appending. The file is created if it does not exist.

@:value(cast "ax+")@:impl@:enumstaticinlineread onlyAppendReadCheck:FsOpenFlag = "ax+"

Like AppendReadCreate but fails if path exists.

@:value(cast "a+")@:impl@:enumstaticinlineread onlyAppendReadCreate:FsOpenFlag = "a+"

Open file for reading and appending. The file is created if it does not exist.

@:value(cast "r")@:impl@:enumstaticinlineread onlyRead:FsOpenFlag = "r"

Open file for reading. An exception occurs if the file does not exist.

@:value(cast "rs")@:impl@:enumstaticinlineread onlyReadSync:FsOpenFlag = "rs"

Open file for reading in synchronous mode. Instructs the operating system to bypass the local file system cache.

This is primarily useful for opening files on NFS mounts as it allows you to skip the potentially stale local cache. It has a very real impact on I/O performance so don't use this flag unless you need it.

Note that this doesn't turn Fs.open into a synchronous blocking call. If that's what you want then you should be using Fs.openSync

@:value(cast "r+")@:impl@:enumstaticinlineread onlyReadWrite:FsOpenFlag = "r+"

Open file for reading and writing. An exception occurs if the file does not exist.

@:value(cast "rs+")@:impl@:enumstaticinlineread onlyReadWriteSync:FsOpenFlag = "rs+"

Open file for reading and writing, telling the OS to open it synchronously. See notes for ReadSync about using this with caution.

@:value(cast "wx")@:impl@:enumstaticinlineread onlyWriteCheck:FsOpenFlag = "wx"

Like WriteCreate but fails if path exists.

@:value(cast "w")@:impl@:enumstaticinlineread onlyWriteCreate:FsOpenFlag = "w"

Open file for writing. The file is created (if it does not exist) or truncated (if it exists).

@:value(cast "wx+")@:impl@:enumstaticinlineread onlyWriteReadCheck:FsOpenFlag = "wx+"

Like WriteReadCreate but fails if path exists.

@:value(cast "w+")@:impl@:enumstaticinlineread onlyWriteReadCreate:FsOpenFlag = "w+"

Open file for reading and writing. The file is created (if it does not exist) or truncated (if it exists).