Opens a text file in the given mode.
True if no more data can be read.
The text codec. The codec is used for reading and writing from and to the file, respectively. Common codecs are supported, for example: “UTF-8”, “UTF-16”, and “ISO 8859-1”.
The path of the file.
Closes the file. It is recommended to always call this function as soon as you are finished with the file.
Commits all written text 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 all data from the file and returns it.
Reads one line of text from the file and returns it. The returned string does not contain the newline characters.
Truncates the file, that is, gives it the size of zero, removing all content.
Writes a string to the file.
Writes a string to the file and appends a newline character.
Generated using TypeDoc
The
TextFile
object is used to read and write files in text mode.When using TextFile.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 binary mode, use BinaryFile instead.