node package manager

bytevector

ByteVector - Space effcient vector for binary data.

node-byte-vector

ByteVector for node.js. Perfect for binary data.

Usage:

var ByteVector = requite('bytevector'),
    vector = new ByteVector([1, 2, 3, 4, 5]); // Our vector

vector.push_back(6); // Insert binary value '6' in the end
vector.pop_front(); // Remove first value (1).

var copy = new ByteVector(vector); // [2, 3, 4, 5, 6]
  • Space effcient. Each element will only use 8 bits memory.
  • Performance wise. It is so fast it can principle be.

All values are saved in a Uint8Array instance which only accepts integer values between 0-255. I

Construct an empty vector with reserved size [int].

Construct a vector with values from [array].

Construct a vector from [array] range: [offset, to_array_end).

Construct the vector from the Uint8Array. It will assume the array has previusly been constrcted with .serialize().

Returns the underlying Uint8Array buffer.

Returns the first element in the vector.

Returns the last element in the vector.

Insert [Uint8] in the back of of the vector.

Remove last item and returns it. Alias for .pop_back()

Reserve [Uint32] amount of memory.

Return reserved memory.

Resize vector size to [Uint32] elements.

Assign this vector using the elements in [obj]. Obj can either be a instance of ByteVector or an object that implements obj.length and obj[N].

Insert [Uint8] in the back of the vector.

Insert [Uint8] in the beginning of the vector.

Remove last item in the vector and returns it.

Remove first element in the beginning of the vector and returns it.

Return element at position [pos].

Set element at position [pos] to value [value].

Removes all elements from the vector.

Returns current vector size.

Returns current vector size.

Resize vector to [N] elements.

Returns a reference to the underlying buffer.