Transferable Objects
Move data efficiently without copying.
The Cost of Cloning
Structured cloning copies data byte by byte. For large buffers (images, audio, big arrays) this copy is slow and doubles memory use. Transferable objects solve this by moving ownership instead of copying.
What Can Be Transferred
Only certain object types are transferable, most importantly ArrayBuffer. Others include MessagePort, ImageBitmap, and OffscreenCanvas.
ArrayBuffer— raw binary memoryMessagePort— a channel endpointImageBitmap— decoded image data
All lessons in this course
- Creating a Web Worker
- Messaging with postMessage
- Transferable Objects
- Use Cases and Limitations