@hugov/byte-views
v0.1.0
Published
ArrayBuffer partitions
Downloads
4
Readme
byte-views
partition an ArrayBuffer into multiple DataViews and/or TypedArrays
import next from '@hugov/byte-views'
const memory = new ArrayBuffer(16),
first = next(memory, Uint8Array, 4), //using first 4 bytes
second = next(first, Uint16Array, 2), //using next 4 bytes
last = next(second) //Uint16Array on the remaining 8 bytes
Limitations
- no protection against accidental memory overlaps if the buffer or reference is reused