
Research
npm Malware Targets Telegram Bot Developers with Persistent SSH Backdoors
Malicious npm packages posing as Telegram bot libraries install SSH backdoors and exfiltrate data from Linux developer machines.
writable-async-iterable-stream
Advanced tools
An async stream which can be iterated over using a for-await-of loop.
An async stream which can be iterated over using a for-await-of loop and which can be written to.
The WritableAsyncIterableStream
class extends the AsyncIterableStream
class.
See https://github.com/SocketCluster/async-iterable-stream
npm install writable-async-iterable-stream
let iterableStream = new WritableAsyncIterableStream();
async function consumeAsyncIterable(asyncIterable) {
// Consume iterable data asynchronously.
for await (let packet of asyncIterable) {
console.log('Packet:', packet);
}
}
consumeAsyncIterable(iterableStream);
setInterval(() => {
// Write data to the stream asynchronously,
iterableStream.write(`Timestamp: ${Date.now()}`);
}, 100);
let iterableStream = new WritableAsyncIterableStream();
async function consumeAsyncIterable(asyncIterable) {
// Consume iterable data asynchronously.
// Works in older environments.
let asyncIterator = stream.createAsyncIterator();
while (true) {
let packet = await asyncIterator.next();
if (packet.done) break;
console.log('Packet:', packet.value);
}
}
consumeAsyncIterable(iterableStream);
setInterval(() => {
// Write data to the stream asynchronously,
iterableStream.write(`Timestamp: ${Date.now()}`);
}, 100);
let iterableStream = new WritableAsyncIterableStream();
// Creates an async generator which only produces packets which are allowed by the
// specified filterFunction.
async function* createFilteredStreamGenerator(fullStream, filterFunction) {
for await (let packet of fullStream) {
if (filterFunction(packet)) {
yield packet;
}
}
};
async function consumeAsyncIterable(asyncIterable) {
// Consume iterable data asynchronously.
for await (let packet of asyncIterable) {
console.log('Packet:', packet);
}
}
// The filter function will only include strings which end with the number 5.
function filterFn(data) {
return /5$/.test(data);
}
let filteredStreamGenerator = createFilteredStreamGenerator(iterableStream, filterFn);
consumeAsyncIterable(filteredStreamGenerator);
setInterval(() => {
// Write data to the stream asynchronously,
iterableStream.write(`Timestamp: ${Date.now()}`);
}, 100);
let iterableStream = new WritableAsyncIterableStream();
(async () => {
let data = await iterableStream.once();
console.log(data);
})();
setInterval(() => {
// Write data to the stream asynchronously,
iterableStream.write(`Timestamp: ${Date.now()}`);
}, 100);
See test/
directory for additional examples.
FAQs
An async stream which can be iterated over using a for-await-of loop.
The npm package writable-async-iterable-stream receives a total of 0 weekly downloads. As such, writable-async-iterable-stream popularity was classified as not popular.
We found that writable-async-iterable-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.
Research
Malicious npm packages posing as Telegram bot libraries install SSH backdoors and exfiltrate data from Linux developer machines.
Security News
pip, PDM, pip-audit, and the packaging library are already adding support for Python’s new lock file format.
Product
Socket's Go support is now generally available, bringing automatic scanning and deep code analysis to all users with Go projects.