> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# Bytes.fromArray

:::info
`Bytes.fromArray` is a re-export of ox's [`Bytes.fromArray`](https://oxlib.sh/api/Bytes/fromArray). Refer to the ox documentation for the full reference.
:::

Converts an array of unsigned 8-bit integers into [`Bytes.Bytes`](/docs/utilities/bytes/types#bytes).

## Imports

```ts
import { Bytes } from 'viem/utils'
```

## Examples

```ts twoslash
// @noErrors
import { Bytes } from 'viem/utils'

const data = Bytes.fromArray([255, 124, 5, 4])
// @log: Uint8Array([255, 124, 5, 4])
```

## Definition

```ts
function fromArray(
  value: readonly number[] | Uint8Array,
): Bytes
```

## Parameters

### value

* **Type:** `readonly number[] | Uint8Array`

Value to convert.

## Return Type

A [`Bytes.Bytes`](/docs/utilities/bytes/types#bytes) instance.

`Bytes`
