The underlying writable stream
The number of bytes that have been written
Appends a byte to the end of the written data
The unsigned byte value to add
Appends a contiguous set of bytes to the end of the written data
The bytes to add
Closes the underlying stream
Pauses the writing process, i.e. bytes added are not written to the underlying output until resume is next called and can be cancelled from being written by calling reset.
If called multiple times, resume and reset only act on bytes added since the most recent pause. Example:
let gb = new GrowableBuffer
gb
.pause()
.add(1).add(2).add(3)
.pause()
.add(4).add(5).add(6)
.reset() //cancels [4, 5, 6]
.resume()
.resume() //resumes [1, 2, 3]
console.log(new Uint8Array(gb.toBuffer())) //Uint8Array [ 1, 2, 3 ]
See pause. Restores state to immediately after this AppendableBuffer was paused. Prevents paused data from ever being flushed to the output.
See pause. Flushes all paused data to the output and exits paused mode.
Generated using TypeDoc
A wrapper around a writable stream to implement AppendableBuffer. The stream must be explicitly closed by calling end after all bytes have been written.