An iterable that you can push values into
npm install it-pushable

> An iterable that you can push values into
An iterable that you can push values into.
``js
import { pushable } from 'it-pushable'
const source = pushable()
setTimeout(() => source.push('hello'), 100)
setTimeout(() => source.push('world'), 200)
setTimeout(() => source.end(), 300)
const start = Date.now()
for await (const value of source) {
console.log(got "${value}" after ${Date.now() - start}ms)done after ${Date.now() - start}ms
}
console.log()
// Output:
// got "hello" after 105ms
// got "world" after 207ms
// done after 309ms
`
`js
import { pushableV } from 'it-pushable'
import all from 'it-all'
const source = pushableV()
source.push(1)
source.push(2)
source.push(3)
source.end()
console.info(await all(source))
// Output:
// [ [1, 2, 3] ]
`
`js
import { pushable } from 'it-pushable'
const source = pushable()
setTimeout(() => source.push('hello'), 100)
setTimeout(() => source.push('world'), 200)
setTimeout(() => source.end(), 300)
const start = Date.now()
for await (const value of source) {
console.log(got "${value}" after ${Date.now() - start}ms)done after ${Date.now() - start}ms
}
console.log()
/*
Output:
got "hello" after 105ms
got "world" after 207ms
done after 309ms
*/
`
`js
import { pushableV } from 'it-pushable'
import all from 'it-all'
const source = pushableV()
source.push(1)
source.push(2)
source.push(3)
source.end()
console.info(await all(source))
/*
Output:
[ [1, 2, 3] ]
*/
`
- it-pipe` Utility to "pipe" async iterables together
-
Licensed under either of
- Apache 2.0, (LICENSE-APACHE /
- MIT (LICENSE-MIT /
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.