GLib.ByteArray.free_to_bytes
Description: Reference for GLib.ByteArray.free_to_bytes

### Function

# GLib ByteArrayfree_to_bytes

since: 2.32

#### Declaration [src]

    GBytes*
    g_byte_array_free_to_bytes (
      GByteArray* array
    )

#### Description [src]

Transfers the data from the `GByteArray` into a new immutable `GBytes`.

The `GByteArray` is freed unless the reference count of `array` is greater than one, in which the `GByteArray` wrapper is preserved but the size of `array` will be set to zero.

This is identical to using `g_bytes_new_take()` and `g_byte_array_free()` together.

Available since: 2.32

#### Parameters

`array`

  Type: An array of `guint8`

  A byte array.

  The called function takes ownership of the data, and is responsible for freeing it.

#### Return value

Type: `GBytes`

The new immutable `GBytes` representing same byte data that was in the array.

The caller of the function takes ownership of the data, and is responsible for freeing it.