
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
pull-thenable
Advanced tools
Converts a pull-stream to an object with .then(), usable also with async-await
npm install --save pull-thenable
As a chain of then's:
const pull = require('pull-stream')
const thenable = require('pull-thenable')
const stream = pull.values(['a','b']);
const source = thenable(stream);
source.then(x => {
console.log(x); // 'a'
return source;
}).then(x => {
console.log(x); // 'b'
return source;
}).then(x => {
// not called
}, err => {
console.log(err); // true
})
With async-await:
const pull = require('pull-stream')
const thenable = require('pull-thenable')
const stream = pull.values(['a','b']);
const source = thenable(stream);
async function main() {
while (true) {
try {
const x = await thenable(readable);
console.log(x); // 'a'
// 'b'
} catch (errOrEnd) {
console.log(errOrEnd); // true
return;
}
}
}
main();
FAQs
Convert a pull-stream into a thenable
The npm package pull-thenable receives a total of 3,016 weekly downloads. As such, pull-thenable popularity was classified as popular.
We found that pull-thenable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.