Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
consumable-stream
Advanced tools
A readable async stream which can be iterated over using a for-await-of loop.
A readable stream which can be iterated over using a for-await-of loop or using a while loop with await inside.
The ConsumableStream
constructor is an abstract class which must be subclassed. Its next()
and createConsumer()
methods must be overriden.
For a concrete subclass of ConsumableStream
, see WritableConsumableStream
: https://github.com/SocketCluster/writable-consumable-stream
npm install consumable-stream
The ConsumableStream
class exposes the following methods:
[Symbol.asyncIterator]
: Makes the instance iterable using a for-await-of loop.next
: Returns a Promise
which will resolve an object in the form {value: data, done: boolean}
whenever some data is received or when the stream ends.once
: Similar to next()
except that the resolved value will be the raw data and it will not resolve when the stream ends. Note that once once()
is called, it cannot be cancelled; the affected closure will stay in memory until either once()
resolves or until the stream is ended or garbage collected.// Consume data objects from consumableStream as they are written to the stream.
(async () => {
for await (let data of consumableStream) {
console.log(data);
}
})();
// Consume only the next data object which is written to the stream.
(async () => {
let data = await consumableStream.once();
console.log(data);
})();
FAQs
A readable async stream which can be iterated over using a for-await-of loop.
The npm package consumable-stream receives a total of 41,956 weekly downloads. As such, consumable-stream popularity was classified as popular.
We found that consumable-stream 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.