Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
it-pushable
Advanced tools
An iterable that you can push values into
npm install it-pushable
const pushable = require('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`)
}
console.log(`done after ${Date.now() - start}ms`)
/*
Output:
got "hello" after 105ms
got "world" after 207ms
done after 309ms
*/
pushable([options])
Create a new async iterable. The values yielded from calls to .next()
or when used in a for await of
loop are "pushed" into the iterable. Returns an async iterable object with the following additional methods:
.push(value)
- push a value into the iterable. Values are yielded from the iterable in the order they are pushed. Values not yet consumed from the iterable are buffered.end([err])
- end the iterable after all values in the buffer (if any) have been yielded. If an error is passed the buffer is cleared immediately and the next iteration will throw the passed erroroptions
is an optional parameter, an object with the following properties:
onEnd
- a function called after all values have been yielded from the iterator (including buffered values). In the case when the iterator is ended with an error it will be passed the error as a parameter.writev
- a boolean used to signal that the consumer of this iterable supports processing multiple buffered chunks at a time. When this option is set to true
values yielded from the iterable will be arrays.Note: the onEnd
function may be passed instead of options
.
Feel free to dive in! Open an issue or submit PRs.
MIT © Alan Shaw
FAQs
An iterable that you can push values into
The npm package it-pushable receives a total of 28,087 weekly downloads. As such, it-pushable popularity was classified as popular.
We found that it-pushable demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.