The index. Negative indices references bytes from the end.
Returns undefined|number
The found byte or undefined if out of bounds.
getCapacity
getCapacity():number
Returns number
the current capacity. When size reaches this capacity then the internal buffer must grow.
getData
getData():Uint8Array
Returns Uint8Array
the written bytes.
getSize
getSize():number
Returns number
the number of bytes written.
reset
reset():void
Resets the sink so it can be used for another operation. This keeps the current capacity and reuses the same
buffer so make sure you finished processing the previous data.
Returns void
rewind
rewind(numBytes:number):void
Rewinds the sink by the given number of bytes. The size shrinks accordingly but the capacity stays the same as
before.
Parameters
numBytes: number
The number of bytes to remove from the end of the sink.
Returns void
write
write(chunk:number|Uint8Array):void
Writes the given chunk to the sink.
Parameters
chunk: number|Uint8Array
Chunk of data to write to the sink.
Returns void
a promise if write operation is asynchronous, nothing when write operation is synchronous.
Sink which writes into a growing Uint8Array.