Gio.OutputStream.write_bytes_async

### Method

# Gio OutputStreamwrite_bytes_async

#### Declaration

    void
    g_output_stream_write_bytes_async (
      GOutputStream* stream,
      GBytes* bytes,
      int io_priority,
      GCancellable* cancellable,
      GAsyncReadyCallback callback,
      gpointer user_data
    )

#### Description

This function is similar to g_output_stream_write_async(), but takes a `GBytes` as input. Due to the refcounted nature of `GBytes`, this allows the stream to avoid taking a copy of the data.

However, note that this function may still perform partial writes, just like g_output_stream_write_async(). If that occurs, to continue writing, you will need to create a new `GBytes` containing just the remaining bytes, using g_bytes_new_from_bytes(). Passing the same `GBytes` instance multiple times potentially can result in duplicated data in the output stream.

For the synchronous, blocking version of this function, see g_output_stream_write_bytes().

#### Parameters

`bytes`

  Type: `GBytes`

  The bytes to write.

  The data is owned by the caller of the method.

`io_priority`

  Type: `int`

  The io priority of the request.

`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.