Newly available A strong fit for performance-sensitive binary workflows where copying large buffers would be wasteful.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
114
114
122
17.4
114
17.4
Built-in object

The transfer() method of ArrayBuffer instances creates a new ArrayBuffer with the same byte content as this buffer, then detaches this buffer.

114
114
122
17.4
114
17.4

The transferToFixedLength() method of ArrayBuffer instances creates a new non-resizable ArrayBuffer with the same byte content as this buffer, then detaches this buffer.

114
114
122
17.4
114
17.4
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)

Syntax

JAVASCRIPT
const buf = new ArrayBuffer(1024);
const transferred = buf.transfer();

buf.byteLength;         // 0 (already detached)
transferred.byteLength; // 1024

Live demo

Check transfer support

Inspect whether ArrayBuffer.prototype.transfer exists.

JavaScript
Output
Press the Run button

Transfer a buffer when supported

Move the contents into a new buffer without manual copying.

JavaScript
Output
Press the Run button

Transfer to a fixed size

Use transferToFixedLength when the runtime exposes the helper.

JavaScript
Output
Press the Run button

Use cases

  • Worker handoff

    Move binary data between threads without duplicating the entire payload in memory.

  • Media and file processing

    Pass decoded or transformed buffers through a pipeline while keeping copies to a minimum.

Cautions

  • After transfer, the original owner loses access to the buffer, so lifecycle mistakes can cause confusing bugs.
  • Explicit transfer semantics are powerful, but they demand clear ownership documentation.

Accessibility

  • Faster large-data transfers can help keep document and media processing responsive.
  • User-facing progress still needs to reflect the work happening across thread boundaries.