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.

Variables

@:value(cast "ax")@:enum@:implinlineread onlyAppendCheck:FsOpenFlag = "ax"

Like AppendCreate but fails if path exists.

@:value(cast "a")@:enum@:implinlineread onlyAppendCreate:FsOpenFlag = "a"

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

@:value(cast "ax+")@:enum@:implinlineread onlyAppendReadCheck:FsOpenFlag = "ax+"

Like AppendReadCreate but fails if path exists.

@:value(cast "a+")@:enum@:implinlineread onlyAppendReadCreate:FsOpenFlag = "a+"

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

@:value(cast "r")@:enum@:implinlineread onlyRead:FsOpenFlag = "r"

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

@:value(cast "rs")@:enum@:implinlineread 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+")@:enum@:implinlineread onlyReadWrite:FsOpenFlag = "r+"

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

@:value(cast "rs+")@:enum@:implinlineread 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")@:enum@:implinlineread onlyWriteCheck:FsOpenFlag = "wx"

Like WriteCreate but fails if path exists.

@:value(cast "w")@:enum@:implinlineread onlyWriteCreate:FsOpenFlag = "w"

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

@:value(cast "wx+")@:enum@:implinlineread onlyWriteReadCheck:FsOpenFlag = "wx+"

Like WriteReadCreate but fails if path exists.

@:value(cast "w+")@:enum@:implinlineread onlyWriteReadCreate:FsOpenFlag = "w+"

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