The mode of a file handle (i.e., a set of open flags and an fdopen mode).
All modes do not translate line endings (i.e., O_BINARY on Windows) and
are not inherited across process creation (i.e., O_NOINHERIT on Windows,
O_CLOEXEC elsewhere).
References:
Constructors
read : IO.FS.Mode
File opened for reading. On open, the stream is positioned at the beginning of the file. Errors if the file does not exist.
-
openflags:O_RDONLY -
fdopenmode:r
write : IO.FS.Mode
File opened for writing. On open, truncate an existing file to zero length or create a new file. The stream is positioned at the beginning of the file.
-
openflags:O_WRONLY | O_CREAT | O_TRUNC -
fdopenmode:w
writeNew : IO.FS.Mode
New file opened for writing. On open, create a new file with the stream positioned at the start. Errors if the file already exists.
-
openflags:O_WRONLY | O_CREAT | O_TRUNC | O_EXCL -
fdopenmode:w
readWrite : IO.FS.Mode
File opened for reading and writing. On open, the stream is positioned at the beginning of the file. Errors if the file does not exist.
-
openflags:O_RDWR -
fdopenmode:r+
append : IO.FS.Mode
File opened for writing. On open, create a new file if it does not exist. The stream is positioned at the end of the file.
-
openflags:O_WRONLY | O_CREAT | O_APPEND -
fdopenmode:a