
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
memory-streams
Advanced tools
Simple implmentation of Stream.Readable and Stream.Writable holding the data in memory.
Memory Streams JS is a light-weight implementation of the Stream.Readable and Stream.Writable abstract classes from node.js. You can use the classes provided to store the result of reading and writing streams in memory. This can be useful when you need pipe your test output for later inspection or to stream files from the web into memory without have to use temporary files on disk.
Forked from https://github.com/paulja/memory-streams-js to be modified
so that .end() calls emit a finish event.
Install with:
npm install memory-streams --save
Sample usage, using the ReadableStream class and piping:
var streams = require('memory-streams');
// Initialize with the string
var reader = new streams.ReadableStream('Hello World\n');
// Send all output to stdout
reader.pipe(process.stdout); // outputs: "Hello World\n"
// Add more data to the stream
reader.append('Hello Universe\n'); // outputs "Hello Universe\n";
Using the ReadableStream class and reading manually:
var streams = require('memory-streams');
// Initialize with the string
var reader = new streams.ReadableStream('Hello World\n');
// Add more data to the stream
reader.append('Hello Universe\n'); // outputs "Hello Universe\n";
// Read the data out
console.log(reader.read().toString()); // outputs: "Hello World\nHello Universe\n"
Using the WritableStream class and piping the contents of a file:
var streams = require('memory-streams')
, fs = require('fs');
// Pipe
var reader = fs.createReadStream('index.js');
var writer = new streams.WritableStream();
reader.pipe(writer);
reader.on('readable', function() {
// Output the content as a string
console.log(writer.toString());
// Output the content as a Buffer
console.log(writer.toBuffer());
});
You can also call the write method directly to store data to the stream:
var streams = require('memory-streams');
// Write method
var writer = new streams.WritableStream();
writer.write('Hello World\n');
// Output the content as a string
console.log(writer.toString()); // Outputs: "Hello World\n"
For more examples you can look at the tests for the module.
MIT
Copyright (c) 2017 Paul Jackson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The stream-buffers package provides similar functionality by offering in-memory readable and writable streams. It allows you to create streams that store data in buffers, which can be useful for testing and buffering data. Compared to memory-streams, stream-buffers offers more control over buffer sizes and behavior.
The memorystream package is another alternative that provides in-memory streams. It is designed to be simple and lightweight, offering basic readable and writable stream functionality. It is similar to memory-streams but may have fewer features and less flexibility.
The mock-stream package is designed for testing purposes, providing in-memory streams that can be used to mock readable and writable streams. It offers additional features for testing, such as simulating errors and controlling stream behavior. It is more focused on testing compared to memory-streams.
FAQs
Simple implmentation of Stream.Readable and Stream.Writable holding the data in memory.
The npm package memory-streams receives a total of 407,891 weekly downloads. As such, memory-streams popularity was classified as popular.
We found that memory-streams 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
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.