For the latest stable version, please use Emilua API 0.10!

stream.write_all

Synopsis

local stream = require "stream"
stream.write_all(io_object, buffer: byte_span|string) -> integer

Description

Write all of the supplied data to the stream and blocks current fiber until it completes or errs.

Returns the buffer's size (number of bytes written).

This operation is implemented in terms of zero or more calls to the stream’s async_write_some function, and is known as a composed operation. The program must ensure that the stream performs no other write operations (such as async_write, the stream’s async_write_some function, or any other composed operations that perform writes) until this operation completes.