1
0
mirror of https://github.com/danog/byte-stream.git synced 2024-12-04 02:07:49 +01:00
byte-stream/docs/iterator-stream.md
2017-05-22 10:34:46 +02:00

19 lines
391 B
Markdown

# IteratorStream
`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(".");
}
$emitter->complete();
});
$inputStream = new IteratorStream($emitter->iterate());
```