Allocates an array in the roaring WASM heap.
Note: Memory is not garbage collected, you are responsible to free the allocated memory calling "dispose" method.
If the parameter is a number, it creates a new uninitialized array of the given length. If the parameter is an Iterable, it creates a copy of the given iterable.
Optional
lengthOrArray: null | number | ArrayLike<number> | Iterable<number>Length of the array to allocate or the array to copy
Optional
arenaAllocator: null | RoaringArenaAllocatorPrivate
#privateInternal
Internal property, do not use.
The length in bytes of the array. For RoaringUint8Array it is equal to this.length
Returns true if this object was deallocated.
Gets a new JS typed array instance that shares the memory used by this buffer. Note that the buffer may point to an outdated WASM memory if the WASM allocated memory grows while using the returned buffer. Use the returned array for short periods of time.
A new typed array that shares the memory with this array.
The at() method takes an integer value and returns the item at that index, allowing for positive and negative integers. Negative integers count back from the last item in the array. Follows the specification for array.at(). If the computed index is less than 0, or equal to length, undefined is returned.
Zero-based index of the array element to be returned, converted to an integer. Negative index counts back from the end of the array — if index < 0, index + array.length is accessed.
The element in the array matching the given index. Always returns undefined if index < -array.length or index >= array.length without attempting to access the corresponding property.
Writes the given array at the specified position
A typed or untyped array of values to set.
Optional
offset: numberThe index in the current array at which the values are to be written.
Sets the value at the given index.
Zero-based index of the array element to be set, converted to an integer. Negative index counts back from the end of the array — if index < 0, index + array.length is accessed.
The value to set at the given index.
True if the value was set, false if the index is out of bounds.
Decreases the size of the allocated memory. It does nothing if the new length is greater or equal to the current length. If the new length is less than 1, it disposes the allocated memory. NOTE: if the value is non zero, this does not reallocate the consumed memory, it just chances the reported size in byteLength and length properties.
The new length in bytes.
True if the memory was shrunk, false if not.
Copies the content of this buffer to a typed array and returns it
Optional
output: Uint8ArrayThe typed array to copy to. If not provided, a new typed array is created.
A typed array with the content of this buffer. It could be smaller than the buffer if the output array is smaller.
Generated using TypeDoc
Array of bytes allocted directly in roaring library WASM memory. Note: to release memory as soon as possible, you are responsible to free the allocated memory calling "dispose" method.