# Buffer

## Specification

### codepage

* Type: `String`
* The semantic of the buffer

{% hint style="info" %}
In combination with type `filename` the buffer can be used for better file input dialog.

```json
[
  {
    "name": "fileName",
    "type": "filename",
    "label": "File name",
    "semantic": "file:name"
  },
  {
    "name": "data",
    "type": "buffer",
    "label": "Data",
    "semantic": "file:data"
  }
]
```

{% endhint %}

## Examples

### Basic buffer

A simple binary buffer field. You can use the `toBinary()` function to convert data to a binary format.

{% tabs %}
{% tab title="Appearance" %}

<div align="left"><figure><img src="https://1562974717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNS0mCBwODiYtOVXjc6qf%2Fuploads%2Fgit-blob-2637f2c1c788ccfd992c0614ef85b9a138ce3b23%2Fbuffer1.png?alt=media" alt="" width="548"><figcaption></figcaption></figure></div>
{% endtab %}

{% tab title="Source" %}

```json
[
	{
		"name": "data",
		"type": "buffer",
		"label": "Data"
	}
]
```

{% endtab %}

{% tab title="Output" %}

<div align="left"><figure><img src="https://1562974717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNS0mCBwODiYtOVXjc6qf%2Fuploads%2Fgit-blob-c21c0dc7f8d99a3eb8b3dab1c160983bf54de362%2FScreen%20Shot%202022-08-30%20at%2016.45.29.png?alt=media" alt="" width="350"><figcaption></figcaption></figure></div>
{% endtab %}
{% endtabs %}

### File input

When combined with the `filename` parameter, the buffer can be used for a file input dialog.

{% tabs %}
{% tab title="Appearance" %}

<div align="left"><figure><img src="https://1562974717-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNS0mCBwODiYtOVXjc6qf%2Fuploads%2Fgit-blob-3758ded61bbb14419b70e4d3c1a90886773ed595%2Fbuffer2a.png?alt=media" alt="" width="563"><figcaption></figcaption></figure></div>
{% endtab %}

{% tab title="Source" %}

```json
[
	{
		"name": "fileName",
		"type": "filename",
		"label": "File name",
		"semantic": "file:name"
	},
	{
		"name": "data",
		"type": "buffer",
		"label": "Data",
		"semantic": "file:data"
	}
]
```

{% endtab %}
{% endtabs %}
