coderef

Resizable buffersBaseline · Newly available

The resize() method of an ArrayBuffer and the grow() method of a SharedArrayBuffer, constructed with the maxByteLength option, changes the size of the buffer in place.

Works in the latest version of every major browser, but older devices may not support it yet. Baseline since Jul 9, 2024.

Browser support

DesktopChrome
1–110Not supported
111+Supportedsince Mar 7, 2023
Current: 155
Edge
12–110Not supported
111+Supportedsince Mar 13, 2023
Current: 154
Firefox
1–127Not supported
128+Supportedsince Jul 9, 2024
Current: 157
Safari
1–16.3Not supported
16.4+Supportedsince Mar 27, 2023
Current: 27
MobileChrome Android
18–110Not supported
111+Supportedsince Mar 7, 2023
Current: 155
Firefox Android
4–127Not supported
128+Supportedsince Jul 9, 2024
Current: 157
Safari iOS
1–16.3Not supported
16.4+Supportedsince Mar 27, 2023
Current: 27

How to use

Every current browser supports this, but it only became Baseline on Jul 9, 2024. Use it as a progressive enhancement, or keep a fallback if you support older devices.

Example

Full syntax and examples are on MDN: maxByteLength.

Feature detection

JS · check before using
if ("resizable" in ArrayBuffer || ("prototype" in ArrayBuffer && "resizable" in ArrayBuffer.prototype)) {
  // ArrayBuffer.resizable is available
}

Sub-features

Support for each part of the feature (8). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
ArrayBuffer.ArrayBuffer.maxByteLength_option11111112816.411112816.4
ArrayBuffer.maxByteLength11111112816.411112816.4
ArrayBuffer.resizable11111112816.411112816.4
ArrayBuffer.resize11111112816.411112816.4
SharedArrayBuffer.SharedArrayBuffer.maxByteLength_option11111112816.411112816.4
SharedArrayBuffer.grow11111112816.411112816.4
SharedArrayBuffer.growable11111112816.411112816.4
SharedArrayBuffer.maxByteLength11111112816.411112816.4