Gio.File.replace_contents_bytes_async

### Method

# Gio Filereplace_contents_bytes_async

since: 2.40

#### Declaration [src]

    void
    g_file_replace_contents_bytes_async (
      GFile* file,
      GBytes* contents,
      const char* etag,
      gboolean make_backup,
      GFileCreateFlags flags,
      GCancellable* cancellable,
      GAsyncReadyCallback callback,
      gpointer user_data
    )

#### Description [src]

Same as `g_file_replace_contents_async()` but takes a `GBytes` input instead. This function will keep a ref on `contents` until the operation is done. Unlike `g_file_replace_contents_async()` this allows forgetting about the content without waiting for the callback.

When this operation has completed, `callback` will be called with `user_user` data, and the operation can be finalized with g_file_replace_contents_finish().

Available since: 2.40

This method completes asynchronously. Use `g_file_replace_contents_finish()` inside the `GAsyncReadyCallback` to obtain the result of the operation.

#### Parameters

`contents`

  Type: `GBytes`

  A `GBytes`.

  The data is owned by the caller of the method.

`etag`

  Type: `const char*`

  A new entity tag for the `file`, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`make_backup`

  Type: `gboolean`

  `TRUE` if a backup should be created.

`flags`

  Type: `GFileCreateFlags`

  A set of `GFileCreateFlags`.

`cancellable`

  Type: `GCancellable`

  Optional `GCancellable` object, `NULL` to ignore.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`callback`

  Type: `GAsyncReadyCallback`

  A `GAsyncReadyCallback` to call when the request is satisfied.

  The argument can be `NULL`.

`user_data`

  Type: `gpointer`

  The data to pass to callback function.

  The argument can be `NULL`.
  The data is owned by the caller of the method.