ArrayBuffer 객체는 일반적인 고정 길이 원시 이진 데이터 버퍼를 나타냅니다.
ArrayBuffer는 바이트로 구성된 배열로, 다른 언어에서는 종종 "바이트 배열"이라고 부릅니다. ArrayBuffer에 담긴 정보를 직접 수정하는 것은 불가능하지만, 대신 형식화 배열이나 DataView 객체를 통해 버퍼를 특정 형식으로 나타내고, 이를 통해 버퍼의 내용을 읽거나 쓸 수 있습니다.
ArrayBuffer() 생성자는 주어진 길이를 가진 새로운 ArrayBuffer를 생성합니다. 또한 Base64 문자열이나 로컬 파일처럼 기존 데이터에서 배열 버퍼를 생성할 수도 있습니다.
생성자
ArrayBuffer()- 새로운
ArrayBuffer객체를 생성합니다.
속성
ArrayBuffer.lengthArrayBuffer생성자의 길이 속성으로, 값은 1입니다.get ArrayBuffer[@@species]- 파생 객체를 생성할 때 사용할 생성자 함수입니다.
ArrayBuffer.prototype- 모든
ArrayBuffer객체에 속성을 추가할 수 있습니다.
메서드
ArrayBuffer.isView()- 주어진 매개변수가 형식화 배열 객체 또는
DataView와 같은ArrayBuffer의 뷰면true를, 아니면false를 반환합니다. ArrayBuffer.transfer()- 주어진 버퍼의 내용으로 새로운 버퍼를 만들고, 그 길이를 지정한 길이만큼 자르거나 확장(0 초기화)한 후 반환합니다.
인스턴스
모든 ArrayBuffer 인스턴스는 ArrayBuffer.prototype을 상속합니다.
속성
ArrayBuffer.prototype.constructor- 객체의 프로토타입을 생성하는 함수를 지정합니다. 초깃값은 내장
ArrayBuffer생성자입니다. ArrayBuffer.prototype.byteLengthRead onlyArrayBuffer의 바이트 길이입니다. 처음 생성 시 정해지며 변경할 수 없습니다.
메서드
ArrayBuffer.prototype.slice()ArrayBuffer를 지정한 위치에서 잘라낸 새로운ArrayBuffer를 반환합니다.
예제
다음 코드는 8바이트 버퍼를 생성하고, Int32Array 뷰로 그 버퍼를 참조합니다.
const buffer = new ArrayBuffer(8); const view = new Int32Array(buffer);
명세
| Specification |
|---|
| ECMAScript (ECMA-262) The definition of 'ArrayBuffer' in that specification. |
브라우저 호환성
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
| Desktop | Mobile | Server | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ArrayBuffer | Chrome Full support 7 | Edge Full support 12 | Firefox Full support 4 | IE Full support 10 | Opera Full support 11.6 | Safari Full support 5.1 | WebView Android Full support 4 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support 12 | Safari iOS Full support 4.2 | Samsung Internet Android Full support 1.0 | nodejs Full support 0.10 |
ArrayBuffer() constructor | Chrome Full support 7 | Edge Full support 12 | Firefox Full support 4 | IE Full support 10 | Opera Full support 11.6 | Safari Full support 5.1 | WebView Android Full support 4 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support 12 | Safari iOS Full support 4.2 | Samsung Internet Android Full support 1.0 | nodejs Full support 0.10 |
byteLength | Chrome Full support 7 | Edge Full support 12 | Firefox Full support 4 | IE Full support 10 | Opera Full support 11.6 | Safari Full support 5.1 | WebView Android Full support 4 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support 12 | Safari iOS Full support 4.2 | Samsung Internet Android Full support 1.0 | nodejs Full support 0.10 |
isView | Chrome Full support 32 | Edge Full support 12 | Firefox Full support 29 | IE Full support 11 | Opera Full support 19 | Safari Full support 7 | WebView Android Full support ≤37 | Chrome Android Full support 32 | Firefox Android Full support 29 | Opera Android Full support 19 | Safari iOS Full support 7 | Samsung Internet Android Full support 2.0 | nodejs Full support 4.0.0 |
slice | Chrome Full support 17 | Edge Full support 12 | Firefox
Full support
12
| IE Full support 11 | Opera Full support 12.1 | Safari Full support 6 | WebView Android Full support ≤37 | Chrome Android Full support 18 | Firefox Android
Full support
14
| Opera Android Full support 12.1 | Safari iOS Full support 6 | Samsung Internet Android Full support 1.0 | nodejs Full support 0.12 |
@@species | Chrome Full support 51 | Edge Full support 13 | Firefox Full support 48 | IE No support No | Opera Full support 38 | Safari Full support 10 | WebView Android Full support 51 | Chrome Android Full support 51 | Firefox Android Full support 48 | Opera Android Full support 41 | Safari iOS Full support 10 | Samsung Internet Android Full support 5.0 | nodejs
Full support
6.5.0
|
Legend
- Full support
- Full support
- No support
- No support
- See implementation notes.
- See implementation notes.
- User must explicitly enable this feature.
- User must explicitly enable this feature.