File.loadContents

bool loadContents(gio.cancellable.Cancellable cancellable, out ubyte[] contents, out string etagOut)

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 contents should be freed with [glib.global.gfree] 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.types.IOErrorEnum.Cancelled] will be returned.

Parameters

cancellableoptional #GCancellable object, null to ignore
contentsa location to place the contents of the file
etagOuta location to place the current entity tag for the file, or null if the entity tag is not needed

Returns

true if the file's contents were successfully loaded.

false if there were errors.

Throws

[ErrorWrap]