### Function

# Mtk AnonymousFile new

#### Declaration [src]

    MtkAnonymousFile*
    mtk_anonymous_file_new (
      const char* name,
      size_t size,
      const uint8_t* data
    )

#### Description [src]

Create a new anonymous read-only file of the given size and the given data The intended use-case is for sending mid-sized data from the compositor to clients.

When done, free the data using mtk_anonymous_file_free().

If this function fails errno is set.

The name is used to as part of the file name.

This function is not directly available to language bindings.

#### Parameters

`name`

  Type: `const char*`

  Name of the file.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`size`

  Type: `size_t`

  The size of `data`.

`data`

  Type: `const uint8_t*`

  The data of the file with the size `size`.

  The data is owned by the caller of the function.

#### Return value

Type: `MtkAnonymousFile`

The newly created `MetaAnonymousFile`, or NULL on failure. Use `mtk_anonymous_file_free()` to free the resources when done.

The data is owned by the called function.