Gio.File.prototype.read
function read(cancellable: Gio.Cancellable): Gio.FileInputStream { // Gjs wrapper for g_file_read() }
Opens a file for reading. The result is a Gio.FileInputStream that can be used to read the contents of the file.
If cancellable is not null, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error Gio.IOErrorEnum.cancelled will be returned.
If the file does not exist, the Gio.IOErrorEnum.not_found error will be returned. If the file is a directory, the Gio.IOErrorEnum.is_directory error will be returned. Other errors are possible too, and depend on what kind of filesystem the file is on.
- cancellable
- Returns
Gio.FileInputStream or null on error. Free the returned object with GObject.Object.prototype.unref.