mirror of
https://github.com/danog/byte-stream.git
synced 2024-11-26 20:04:51 +01:00
Add IteratorStream docs
This commit is contained in:
parent
adac8fe7b6
commit
bf2565baa0
@ -1,3 +1,16 @@
|
|||||||
# IteratorStream
|
# IteratorStream
|
||||||
|
|
||||||
TBD
|
`IteratorStream` allows converting an `Amp\Iterator` that yields strings into an `InputStream`.
|
||||||
|
|
||||||
|
```php
|
||||||
|
$emitter = new Emitter;
|
||||||
|
|
||||||
|
asyncCoroutine(function () use ($emitter) {
|
||||||
|
for ($i = 0; $i < 10; $i++) {
|
||||||
|
yield new Delayed(1000);
|
||||||
|
yield $emitter->emit(".");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$inputStream = new IteratorStream($emitter->iterate());
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user