Get to know MDN better
Esta página foi traduzida do inglês pela comunidade. Saiba mais e junte-se à comunidade MDN Web Docs.
This feature is well established and works across many devices and browser versions. It’s been available across browsers since julho de 2015.
* Some parts of this feature may have varying levels of support.
O objeto ArrayBuffer é um tipo de dado usado para representar um genérico, buffer de dados binários de tamanho fixo. Você não pode manipular diretamente os conteúdos de um ArrayBuffer; em vez disso, você cria um objeto ArrayBufferView que representa o buffer em um formato específico, e usa para ler e escrever os conteúdos do buffer.
The size, in bytes, of the array buffer to create.
A new ArrayBuffer object of the specified size. Its contents are initialized to 0.
A RangeError is thrown if the length is larger than Number.MAX_SAFE_INTEGER (>= 2 ** 53) or negative.
The ArrayBuffer constructor creates a new ArrayBuffer of the given length in bytes.
The ArrayBuffer constructor's length property whose value is 1.
get ArrayBuffer[@@species]The constructor function that is used to create derived objects.
ArrayBuffer.prototypeAllows the addition of properties to all ArrayBuffer objects.
Returns true if arg is one of the ArrayBuffer views, such as typed array objects or a DataView. Returns false otherwise.
ArrayBuffer.transfer(oldBuffer [, newByteLength])Returns a new ArrayBuffer whose contents are taken from the oldBuffer's data and then is either truncated or zero-extended by newByteLength.
All ArrayBuffer instances inherit from ArrayBuffer.prototype.
Has the same functionality as ArrayBuffer.prototype.slice().
In this example, we create a 8-byte buffer with a Int32Array view referring to the buffer:
var buffer = new ArrayBuffer(8); var view = new Int32Array(buffer);| ECMAScript® 2027 Language Specification # sec-arraybuffer-objects |
Enable JavaScript to view this browser compatibility table.
Starting with ECMAScript 2015, ArrayBuffer constructors require to be constructed with a new operator. Calling an ArrayBuffer constructor as a function without new, will throw a TypeError from now on.
This page was last modified on 17 de fev. de 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.