A DataView for node Buffers.
npm install bufferview
|2||downloads in the last month|
|Version||1.0.1 last updated 2 months ago|
|Keywords||net, array, buffer, arraybuffer, typed array, bytebuffer|
This one is simple: It's doing exactly what DataView does but takes a node.js Buffer for it. The sole difference is that it additionally provides some convenience methods to work with interchangeable BufferView and DataView instances, depending on the backing buffer:
BufferView.create(Buffer|ArrayBuffer):BufferView|DataViewcreates a BufferView if wrapping a Buffer and a DataView otherwise
BufferView.isBufferView(*):booleantests if a view is a BufferView wrapping a Buffer
BufferView.isDataView(*):booleantests if a view is a DataView wrapping an ArrayBuffer
This basically lets you write code that is independent of what kind of buffer your backing buffer is, so that your library does not need to copy back and forth between Buffers and ArrayBuffers - that would be sad.
- Extends DataView for
- Well tested
- Lean (BufferView.min.js is ~3KB)
License: Apache License, Version 2.0