JavaScript ArrayBuffer Methods

About This Index
This page is the JavaScript ArrayBuffer Methods index for the tutorial track. Each row links to a full guide with syntax, three runnable examples, browser notes, and FAQs.
Learn what an ArrayBuffer is on /js/array-buffer. Use this page when you need a specific API such as slice(), resize(), or transfer().
ArrayBuffer methods copy, resize, and move memory. To read or write individual bytes, wrap the buffer in a typed array such as Uint8Array or in a DataView.
How to Call an ArrayBuffer Method
Instance methods use a dot on the buffer; the one static helper uses ArrayBuffer:
const buffer = new ArrayBuffer(8, { maxByteLength: 16 });
const bytes = new Uint8Array(buffer); // a view for reading and writing
// Instance (ArrayBuffer.prototype)
buffer.slice(0, 4); // new 4-byte copy
buffer.resize(12); // grow in place (ES2024)
const moved = buffer.transfer(); // move bytes, detach buffer (ES2024)
moved.transferToFixedLength(); // move again, lock the size (ES2024)
// Static (on ArrayBuffer)
ArrayBuffer.isView(bytes); // true JavaScript ArrayBuffer Methods Table
All method guides in this JavaScript tutorial series (5 tutorials), grouped by what they do.
Check for views
1 methodA static helper on the ArrayBuffer constructor that tells views (typed arrays and DataView) apart from everything else.
| Method | Description | Tutorial |
|---|---|---|
ArrayBuffer.isView() | Check whether a value is a view (any typed array or a DataView) over an ArrayBuffer. | Open |
Resize in place
1 methodGrow or shrink a buffer that was created with maxByteLength, without allocating a new one (ES2024).
Copy bytes
1 methodCopy a byte range into a new, independent buffer. Works on every ArrayBuffer since ES2015.
Transfer ownership
2 methodsMove the bytes into a new buffer and detach the original, optionally changing the length on the way (ES2024).
| Method | Description | Tutorial |
|---|---|---|
transfer() | Move the bytes into a new ArrayBuffer (optionally resized) and detach the original (ES2024). | Open |
transferToFixedLength() | Move the bytes into a new fixed-length ArrayBuffer and detach the original (ES2024). | Open |
ArrayBuffer Properties and Constructor
These are read with a dot (no parentheses) or used with new. They are listed here for quick reference.
| Member | What it gives you | Since |
|---|---|---|
new ArrayBuffer(length) | Create a fixed-length buffer of length bytes, all set to 0. | ES2015 |
new ArrayBuffer(length, { maxByteLength }) | Create a resizable buffer that resize() can grow up to maxByteLength. | ES2024 |
buffer.byteLength | Current size in bytes. It changes after resize() and becomes 0 after a transfer. | ES2015 |
buffer.maxByteLength | The largest size resize() allows. For a fixed-length buffer it equals byteLength. | ES2024 |
buffer.resizable | true when the buffer was created with maxByteLength. | ES2024 |
buffer.detached | true after transfer() or transferToFixedLength() moved the bytes away. | ES2024 |
Frequently Asked Questions
Start with ArrayBuffer.isView()
Learn to accept either a raw buffer or a typed array in your functions.
14 people found this page helpful
