1
0
mirror of https://github.com/danog/byte-stream.git synced 2024-12-12 17:37:35 +01:00
byte-stream/docs/iterator-stream.md

15 lines
344 B
Markdown
Raw Normal View History

2017-05-28 19:24:13 +02:00
---
title: IteratorStream
permalink: /iterator-stream
---
2017-05-22 10:33:48 +02:00
`IteratorStream` allows converting an `Amp\Iterator` that yields strings into an `InputStream`.
```php
$inputStream = new IteratorStream(new Producer(function (callable $emit) {
2017-05-22 10:33:48 +02:00
for ($i = 0; $i < 10; $i++) {
yield new Delayed(1000);
yield $emit(".");
2017-05-22 10:33:48 +02:00
}
});
```