Function writeDataToStream

  • Creates a data writer for the given stream, passes it to the given callback function, flushes the data writer and release the stream writer lock after callback execution.

    Parameters

    • stream: WritableStream<Uint8Array>

      The stream to write to.

    • callback: (writer: DataWriter) => void | Promise<void>

      The callback function to call with the created data writer as argument.

    • Optionaloptions: DataWriterOptions

      Optional data writer options.

    Returns Promise<void>