Method
StringBuffer::readFromResource
Starts a coroutine that reads the stream into the buffer, and ends the buffer when the stream ends.
Description#
public StringBuffer::readFromResource(
$resource
): FiberSets the stream to non-blocking. The coroutine stops reading while more than 1 MiB is unread.
Parameters#
- $resource
- A stream to read from
Return values#
The coroutine; await it to see a read error Fiber
Errors / Exceptions#
| Exception | When |
|---|---|
InvalidArgumentException | If $resource is not a stream |
See also#
StringBuffer::writeToResourceStarts a coroutine that writes the buffer to the stream until the buffer has ended and been read.