| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer | [Back] [Original] |
Get to know MDN better
Esta pgina foi traduzida do ingls pela comunidade. Saiba mais e junte-se comunidade MDN Web Docs.
This feature is well established and works across many devices and browser versions. Its 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 genrico, buffer de dados binrios de tamanho fixo. Voc no pode manipular diretamente os contedos de um ArrayBuffer; em vez disso, voc cria um objeto ArrayBufferView que representa o buffer em um formato especfico, e usa para ler e escrever os contedos do buffer.
// Create an ArrayBuffer with a size in bytes
const buffer = new ArrayBuffer(8);
console.log(buffer.byteLength);
// Expected output: 8
new ArrayBuffer(length)
lengthThe 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.
ArrayBuffer.lengthThe ArrayBuffer constructor's length property whose value is 1.
get ArrayBuffer[@@species]The constructor function that is used to create derived objects.
ArrayBufferAllows the addition of properties to all ArrayBuffer objects.
ArrayBuffer.isView(arg)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.
ArrayBuffer.slice() 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);
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-arraybuffer-objects |
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.
var dv = ArrayBuffer(10);
// TypedError: calling a builtin ArrayBuffer constructor
// without new is forbidden
var dv = new ArrayBuffer(10);
This page was last modified on 22 de mai. de 2026 by MDN contributors.
ArrayBufferObject/FunctionObject.prototype.__defineGetter__()Object.prototype.__defineSetter__()Object.prototype.__lookupGetter__()Object.prototype.__lookupSetter__()Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.propertyIsEnumerable()Object.prototype.toLocaleString()Object.prototype.toString()Object.prototype.valueOf()Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |