---
title: Binary utilities
description: Normalize browser and Node.js binary inputs into predictable ArrayBuffer views before parsing.
hide_title: true
page_style: designed
---
import {DocPageHeader} from '@site/src/components/docs/doc-page-header';
import {DocOrientation, ReferenceBoundary} from '@site/src/components/docs/designed-doc';
loaders.gl provides a set of functions to simplify working with binary data. There are a couple of different ways to deal with binary data in the JavaScript APIs for browser and Node.js, and some small but annoying "gotchas" that can trip up programmers when working with binary data.
## Usage
```typescript
import {toArrayBuffer} from '@loaders.gl/core/loader-utils';
```
## Functions
### toArrayBuffer(binaryData : \*) : ArrayBuffer
Converts an `ArrayBuffer`, shared array buffer, typed-array view, Node.js buffer,
or string to an `ArrayBuffer`. Strings are encoded as UTF-8. Full-buffer views can
reuse their backing buffer; partial views are sliced to their byte range, and
shared buffers are copied.
Native `Blob` values require asynchronous reading with `await blob.arrayBuffer()`;
this synchronous helper does not read them.