@hugov/byte-views

0.1.0 • Public • Published

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

License

MIT © Hugo Villeneuve

/@hugov/byte-views/

    Package Sidebar

    Install

    npm i @hugov/byte-views

    Weekly Downloads

    0

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    2.68 kB

    Total Files

    4

    Last publish

    Collaborators

    • hugov