splitArrowBuffers
splitArrowBuffers rebuilds Apache Arrow JS objects so sliced internal typed-array buffers are
copied into standalone ArrayBuffers. Internal typed arrays that already span their full backing
ArrayBuffer are reused by default.
This isolates sliced typed-array views before transferring their buffers. Whole-buffer views
are still shared with the input by default; use copy: 'all' when the original table must remain
usable after transfer.
Usageโ
import {splitArrowBuffers} from '@math.gl/core/arrow';
const transferSafeTable = splitArrowBuffers(arrowTable);
// Use the rebuilt arrowTable locally, or dehydrate it before posting across a worker boundary.
APIโ
splitArrowBuffers(input, options);
input may be an Apache Arrow JS Table, RecordBatch, Vector, or Data instance. The return
value is a new real Arrow object of the same kind.
options.copy controls copying:
| Value | Behavior |
|---|---|
'none' | Reuse typed arrays unless retained |
'sliced' | Default. Copy only typed arrays that view a larger backing ArrayBuffer |
'all' | Copy every Arrow internal typed array |
Compatibility Aliasโ
splitArrowTableBuffers(arrowTable, options) is available as a table-only alias.
Notesโ
splitArrowBuffers does not collect transfer lists and does not rehydrate serialized Arrow objects.
It only isolates Arrow internal buffers so later transfer-list collection can safely transfer binary
data without detaching unrelated memory.
Use copy: 'none' only when the sender owns the relevant backing buffers, is done with the source
table, no other live data depends on those buffers, and any unrelated bytes in the full backing
ArrayBuffers are safe to expose to the receiver.
Structured cloning an Arrow instance does not preserve its prototypes. For worker transport, use dehydrateArrowTable and hydrateArrowTable.