replace_contents_async


Description:

public async bool replace_contents_async (uint8[] contents, string? etag, bool make_backup, FileCreateFlags flags, Cancellable? cancellable = null, out string new_etag) throws Error

Starts an asynchronous replacement of this with the given contents of contents.length bytes.

etag will replace the document's current entity tag.

When this operation has completed, callback will be called with user_user data, and the operation can be finalized with replace_contents_async.end.

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 g_io_error_cancelled will be returned.

If make_backup is true, this function will attempt to make a backup of this.

Note that no copy of content will be made, so it must stay valid until callback is called. See replace_contents_bytes_async for a Bytes version that will automatically hold a reference to the contents (without copying) for the duration of the call.

Parameters:

this

input File

contents

string of contents to replace the file with

etag

a new entity tag for the this, or null

make_backup

true if a backup should be created

flags

a set of FileCreateFlags

cancellable

optional Cancellable object, null to ignore

callback

a AsyncReadyCallback to call when the request is satisfied

length

the length of contents in bytes

user_data

the data to pass to callback function