### Function

# FwupdPlugin base64_encode

since: 2.1.5

#### Declaration [src]

    gchar*
    fu_base64_encode (
      const guint8* buf,
      gsize bufsz
    )

#### Description [src]

Encode a sequence of binary data into its Base-64 stringified representation.

This should be used in preference to `g_base64_encode()` as GLib < 2.60.0 would return a critical warning if `data` is NULL.

Available since: 2.1.5

#### Parameters

`buf`

  Type: `const guint8*`

  Data blob.

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

`bufsz`

  Type: `gsize`

  Size of `data`.

#### Return value

Type: `gchar*`

Zero-terminated Base-64 encoded string representing data, or an empty string for no data.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.