infinity.fileMode¶
Provides enums for file access modes.
Module: none (built-in)
infinity.fileMode¶
Used e.g. by the infinity.stream constructor. An access mode (create, read, write or readWrite) can be combined with a sharing mode (shareExclusive, shareDenyWrite or shareDenyNone) using |.
Values:
-
create:
65280Creates the file (opened for reading and writing). An existing file is overwritten.
-
read:
0Opens the file for reading only.
-
write:
1Opens the file for writing only.
-
readWrite:
2Opens the file for reading and writing.
-
exclusive:
4Combined with
create: creates the file only if it does not exist yet, fails otherwise. -
shareExclusive:
16Denies read and write access to all others.
-
shareDenyWrite:
32Denies write access to all others.
-
shareDenyNone:
64(Windows),48(Linux, macOS)No sharing restrictions.
Example:
infinity.loadModule('infinity.stream');
let fileStream = new infinity.stream('data.bin', infinity.fileMode.create | infinity.fileMode.shareDenyWrite);
fileStream.free();