Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since March 2017.
Note: This feature is available in Web Workers.
The arrayBuffer() method of the Response interface takes a Response stream and reads it to completion. It returns a promise that resolves with an ArrayBuffer.
None.
A promise that resolves with an ArrayBuffer.
The request was aborted.
TypeErrorThrown for one of the following reasons:
Thrown if there is a problem creating the associated ArrayBuffer (for example, if the data size is too large).
In our fetch array buffer live, we have a Play button. When pressed, the getData() function is run. Note that before playing full audio file will be downloaded. If you need to play ogg during downloading (stream it) - consider HTMLAudioElement:
In getData() we create a new request using the Request() constructor, then use it to fetch an OGG music track. We also use AudioContext.createBufferSource to create an audio buffer source. When the fetch is successful, we read an ArrayBuffer out of the response using arrayBuffer(), decode the audio data using AudioContext.decodeAudioData(), set the decoded data as the audio buffer source's buffer (source.buffer), then connect the source up to the AudioContext.destination.
Once getData() has finished running, we start the audio source playing with start(0), then disable the play button so it can't be clicked again when it is already playing (this would cause an error.)
The Response() constructor accepts Files and Blobs, so it may be used to read a File into other formats.
| Fetch # ref-for-dom-body-arraybuffer① |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Nov 7, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.