This is a utility class that simplifies and unifies write operations over some writable handle-like obejct.


Usually, application software does not construct streams but use u8 sources for it. Use constructor only to connect new source.

const output = new OutputStream(handle, buferLength = defaultBufferSize);
  • handle: handle-like object providing async read(maxSize) returning proxy resolving to Unit8Array with loaded data.

Binary operations

await output.write([1,2,3]); // write bytes 0x01, 0x02 and 0x03

writes bunary data from array which should contain byte-size numbers e.g. (0..255) or an Unit8Array instance.

The promise resovles when all data are written. It is safe to call several writes without awaiting them an dthen await last or all.

Common operations

await output.close();

closes the stream. further operation will fail.