ArrayBuffer
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2015ë 7ì.
* Some parts of this feature may have varying levels of support.
ArrayBuffer ê°ì²´ë ì¼ë°ì ì¸ ìì ë°ì´ë리 ë°ì´í° ë²í¼ë¥¼ íííë ë° ì¬ì©ë©ëë¤.
ë¤ë¥¸ ì¸ì´ììë ì¢
ì¢
"ë°ì´í¸ ë°°ì´"ì´ë¼ê³ ë¶ë¥´ë ë°ì´í¸ ë°°ì´ì
ëë¤. ArrayBufferì ë´ì©ì ì§ì ìì íë ê²ì ë¶ê°ë¥íì§ë§, ëì ë²í¼ë¥¼ í¹ì íìì¼ë¡ ëíë´ë íìí ë°°ì´ì´ë DataView ê°ì²´ ì¤ íë를 ìì±íì¬, ì´ë¥¼ íµí´ ë²í¼ì ë´ì©ì ì½ê±°ë ì¸ ì ììµëë¤.
ArrayBuffer() ìì±ìë 주ì´ì§ 길ì´(ë°ì´í¸)를 ê°ì§ ìë¡ì´ ArrayBuffer를 ìì±í©ëë¤. Base64 문ìì´ì´ë ë¡ì»¬ íì¼ê³¼ ê°ì 기존 ë°ì´í°ììë ë°°ì´ ë²í¼ë¥¼ ìì±í ì ììµëë¤.
ArrayBufferë Transferable objectsì
ëë¤.
ì¤ëª
>ArrayBuffers í¬ê¸° ì¡°ì í기
ArrayBuffer ê°ì²´ë ArrayBuffer() ìì±ì를 í¸ì¶í ë maxByteLength ìµì
ì í¬í¨íì¬ í¬ê¸°ë¥¼ ì¡°ì í ì ìëë¡ ë§ë¤ ì ììµëë¤. ArrayBufferì í¬ê¸°ë¥¼ ì¡°ì í ì ìëì§ ì¬ë¶ ê·¸ë¦¬ê³ ìµë í¬ê¸°ë ê°ê° resizableì maxByteLength ìì±ì ì ê·¼íì¬ ì§ì í ì ììµëë¤. resize() í¸ì¶ë¡ í¬ê¸° ì¡°ì ì´ ê°ë¥í ArrayBufferì ì í¬ê¸°ë¥¼ í ë¹í ì ììµëë¤. ì ë°ì´í¸ë 0ì¼ë¡ ì´ê¸°íë©ëë¤.
ì´ë¬í 기ë¥ì ì¬ì©íë©´ ArrayBufferì í¬ê¸°ë¥¼ ë í¨ì¨ì ì¼ë¡ ì¡°ì í ì ììµëë¤.
ê·¸ë ì§ ìì¼ë©´ ìë¡ì´ í¬ê¸°ë¡ ë²í¼ì ë³µì¬ë³¸ì ë§ë¤ì´ì¼ í©ëë¤. ëí ì´ì ê´ë ¨íì¬ WebAssemblyì JavaScript í¨ë¦¬í°ë¥¼ ì ê³µí©ëë¤(Wasm ì í ë©ëª¨ë¦¬ë WebAssembly.Memory.prototype.grow()ë¡ í¬ê¸°ë¥¼ ì¡°ì í ì ììµëë¤).
ArrayBuffers ì ì¡í기
ArrayBuffer ê°ì²´ë Web Workers í¹ì ìë¹ì¤ ì커, structured clone algorithm ì¬ì©ê³¼ ê°ì´ ê°ê¸° ë¤ë¥¸ ì¤í 문맥 ê°ì ì ì¡ë ì ììµëë¤. ì´ë Worker.postMessage() í¹ì ServiceWorker.postMessage() í¸ì¶ìì ì ì¡ ê°ë¥í ê°ì²´ë¡ ArrayBuffer를 ì ë¬í¨ì¼ë¡ì ì²ë¦¬ë ì ììµëë¤. ììí JavaScriptììë transfer() í¹ì transferToFixedLength() ë©ìë를 ì¬ì©íì¬ ë©ëª¨ë¦¬ ìì ê¶ì íëì ArrayBufferìì ë¤ë¥¸ ArrayBufferë¡ ì´ì í ìë ììµëë¤.
ArrayBufferê° ì ì¡ëë©´ ì본ì ë ì´ì ì¬ì©í ì ìê² ëë ë¶ë¦¬ ìíê° ë©ëë¤. ì´ë ìê°ìë ì¤ì ë¡ ë©ëª¨ë¦¬ì ì ê·¼í ì ìë ArrayBufferì ë³µì¬ë³¸ì íëë§ ì¡´ì¬íê² ë©ëë¤. ë¶ë¦¬ë ë²í¼ë ë¤ìê³¼ ê°ì ëìì í©ëë¤.
byteLengthë 0ì´ ë©ëë¤(ë²í¼ì ì°ê´ë íìí ë°°ì´ ë·° 모ëìì).resize()ìslice()ì ê°ì ë©ìëë í¸ì¶ë ëTypeError를 ë°ììíµëë¤. ì°ê´ë íì ì´ ì§ì ë ë°°ì´ ë·°ì ë©ìëëTypeError를 ëì§ëë¤. ì°ê´ë íìí ë°°ì´ ë·°ì ë©ìë ììTypeError를 ë°ììíµëë¤.
ArrayBufferê° ë¶ë¦¬ëìëì§ ì¬ë¶ë detached ìì±ì¼ë¡ íì¸í ì ììµëë¤.
ìì±ì
ArrayBuffer()-
ìë¡ì´
ArrayBufferê°ì²´ë¥¼ ìì±í©ëë¤.
ì ì ìì±
get ArrayBuffer[@@species]-
íì ê°ì²´ë¥¼ ë§ëë ë° ì¬ì©ëë ìì±ì í¨ìì ëë¤.
ì ì ë©ìë
ArrayBuffer.isView()-
argì íì´ íìí ë°°ì´ ê°ì²´ì´ê±°ëDataViewì ê°ì ArrayBuffer ì¤ íëì¸ ê²½ì°,true를 ë°íí©ëë¤. ê·¸ë ì§ ìì¼ë©´false를 ë°íí©ëë¤.
ì¸ì¤í´ì¤ ìì±
ë¤ì ìì±ì ArrayBuffer.prototypeì ì ìëì´ ìì¼ë©° 모ë ArrayBuffer ì¸ì¤í´ì¤ì ê³µì ë©ëë¤.
ArrayBuffer.prototype.byteLength-
ArrayBufferì ì½ê¸° ì ì© í¬ê¸°(ë°ì´í¸)ì ëë¤. ë°°ì´ë¦¬ 구ì±ë ë ì¤ì ëë©° ë³ê²½í ì ììµëë¤.
ArrayBuffer.prototype.byteLength-
ArrayBufferì ë°ì´í¸ ë¨ìì í¬ê¸°ì ëë¤. ë°°ì´ì´ ìì±ë ë ì¤ì ëë©°,ArrayBufferì í¬ê¸°ë¥¼ ë³ê²½í ì ìë ê²½ì°ìë§ArrayBuffer.prototype.resize()ë©ìë를 ì¬ì©íì¬ ë³ê²½í ì ììµëë¤. ArrayBuffer.prototype.constructor-
ì¸ì¤í´ì¤ ê°ì²´ë¥¼ ë§ëë ìì±ì í¨ìì ëë¤.
ArrayBufferì¸ì¤í´ì¤ì ê²½ì°ArrayBufferìì±ìê° ì´ê¸° ê°ì ëë¤. ArrayBuffer.prototype.detached-
ì½ê¸° ì ì©ì ëë¤. ë§ì½
ArrayBufferê° ë¶ë¦¬(ì ì¡)ëìë¤ë©´true를 ë°ííê³ ê·¸ë ì§ ìì¼ë©´false를 ë°íí©ëë¤. ArrayBuffer.prototype.maxByteLength-
ArrayBufferì í¬ê¸°ê° ì¡°ì ê°ë¥í ë°ì´í¸ ë¨ìì ì½ê¸° ì ì© ìµë í¬ê¸° ì ëë¤. ë°°ì´ì´ ìì±ë ë ì¤ì ëë©° ë³ê²½ë ì ììµëë¤. ArrayBuffer.prototype.resizable-
ì½ê¸° ì ì©ìëë¤.
ArrayBufferê° í¬ê¸° ì¡°ì ì´ ê°ë¥íë¤ë©´true를 ë°ííê³ ê·¸ë ì§ ìì¼ë©´false를 ë°íí©ëë¤. ArrayBuffer.prototype[@@toStringTag]-
@@toStringTagìì±ì ì´ê¸°ê°ì 문ìì´"ArrayBuffer"ì ëë¤. ì´ ìì±ìObject.prototype.toString()ìì ì¬ì©í©ëë¤.
ì¸ì¤í´ì¤ ë©ìë
ArrayBuffer.prototype.resize()-
ë°ì´í¸ ë¨ìì
ArrayBufferì í¬ê¸°ë¥¼ ì§ì ë í¬ê¸°ë¡ ì¬ì¡°ì í©ëë¤. ArrayBuffer.prototype.slice()-
ì´
ArrayBufferìbeginì í¬í¨í ì§ì ë¶í°end미ë§ì ë°ì´í¸ê° ë³µì¬ë ìArrayBuffer를 ë°íí©ëë¤.beginëëendê° ììë¼ë©´ ë°°ì´ì ììì´ ìë ë§ì§ë§ ì¸ë±ì¤ë¥¼ 참조í©ëë¤. ArrayBuffer.prototype.transfer()-
ì´ ë²í¼ì ëì¼í ë°ì´í¸ ë´ì©ì¼ë¡ ì
ArrayBuffer를 ìì±í©ëë¤. ê·¸ ë¤ì ì´ ë²í¼ë¥¼ ë¶ë¦¬í©ëë¤. ArrayBuffer.prototype.transferToFixedLength()-
ì´ ë²í¼ì ëì¼í ë°ì´í¸ ë´ì©ì¼ë¡ í¬ê¸° ì¡°ì ì´ ë¶ê°í ì
ArrayBuffer를 ìì±í©ëë¤. ê·¸ ë¤ì ì´ ë²í¼ë¥¼ ë¶ë¦¬í©ëë¤. ArrayBuffer.prototype.slice()-
컨í ì¸ ì
beginì í¬í¨í ì§ì ë¶í°end미ë§ê¹ì§ í´ë¹ArrayBufferì ë°ì´í¸ ë³µì¬ë³¸ì¸ ìArrayBuffer를 ë°íí©ëë¤.beginëëendê° ììì´ë©´ ì²ìë¶í°ê° ìëë¼ ë°°ì´ ëìì ì¸ë±ì¤ë¥¼ 참조í©ëë¤.
ìì
>ArrayBuffer ë§ë¤ê¸°
ì´ ìììë ë²í¼ë¥¼ 참조íë Int32Array ë·°ê° ìë 8ë°ì´í¸ ë²í¼ë¥¼ ë§ëëë¤.
const buffer = new ArrayBuffer(8);
const view = new Int32Array(buffer);
ëª ì¸ì
| Specification |
|---|
| ECMAScript® 2027 Language Specification> # sec-arraybuffer-objects> |