Constructs a new blocking queue.
Default timeout used for remove() call when no timeout was specified. Defaults to Number.POSITIVE_INFINITY.
Get a copy of the internal data buffer.
Note that the elements themselves are not copied, so if the contents are not native types, do not modify them.
Get the number of elements in the queue.
Get the number of pending promises if no elements are in the queue.
Cancels all pending remove promises.
Optional
err: ErrorClears the queue and returns the internal array.
Add data to the queue but insert it at given index.
0 means that the element becomes the first value in the queue. buffer.length means that the element will become the last element. Negative values means that it is inserted from behind (same as array.slice start parameter)
This will throw if the queue is full.
Add data to the queue but insert sorted.
This requires, that the data was already sorted. If elements that are equal are found, the element is inserted after the equal ones.
This will throw if the queue is full.
Get element from queue.
If no element is in the queue, then the promise will not resolve, until there is.
Optional
timeout: numberTimeout as unsigned 32-bit integer or Number.POSITIVE_INFINITY. If undefined use the default value passed to the constructor.
A queue implementation where the reader promises block until new data is available.