Gio.File.prototype.load_contents

function load_contents(cancellable: Gio.Cancellable): [ok: Boolean, contents: ByteArray, etag_out: String] {
    // Gjs wrapper for g_file_load_contents()
}
  

Loads the content of the file into memory. The data is always zero-terminated, but this is not included in the resultant length. The returned @content should be freed with GLib.free when no longer needed.

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.

cancellable

optional Gio.Cancellable object, null to ignore

ok

true if the file's contents were successfully loaded. false if there were errors.

contents

a location to place the contents of the file

etag_out

a location to place the current entity tag for the file, or null if the entity tag is not needed