Opens a binary file in the given mode.
True if no more data can be read.
The path of the file.
The position that data is written to or read from.
The size of the file (in bytes).
Closes the file. It is recommended to always call this function as soon as you are finished with the file.
Commits all written data to disk and closes the file. Should be called when writing to files in WriteOnly mode. Failing to call this function will result in cancelling the operation, unless safe writing to files is disabled.
Reads at most size
bytes of data from the file and returns it as an ArrayBuffer
.
Reads all data from the file and returns it as an ArrayBuffer
.
Sets the file size (in bytes). If size
is larger than the file currently is, the new bytes
will be set to 0; if size
is smaller, the file is truncated.
Sets the current position to pos
.
Writes data into the file at the current position.
Generated using TypeDoc
The
BinaryFile
object is used to read and write files in binary mode.When using BinaryFile.WriteOnly, you need to call commit when you’re done writing otherwise the operation will be aborted without effect.
To read and write files in text mode, use TextFile instead.