mirror of
https://github.com/danog/byte-stream.git
synced 2024-12-02 17:28:21 +01:00
15 lines
344 B
Markdown
15 lines
344 B
Markdown
---
|
|
title: IteratorStream
|
|
permalink: /iterator-stream
|
|
---
|
|
`IteratorStream` allows converting an `Amp\Iterator` that yields strings into an `InputStream`.
|
|
|
|
```php
|
|
$inputStream = new IteratorStream(new Producer(function (callable $emit) {
|
|
for ($i = 0; $i < 10; $i++) {
|
|
yield new Delayed(1000);
|
|
yield $emit(".");
|
|
}
|
|
});
|
|
```
|