Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

memory-streams

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memory-streams

Simple implmentation of Stream.Readable and Stream.Writable holding the data in memory.

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is memory-streams?

The memory-streams npm package provides in-memory streams for Node.js, allowing you to create readable and writable streams that store data in memory. This can be useful for testing, buffering data, or manipulating streams without relying on file system or network I/O.

What are memory-streams's main functionalities?

WritableStream

Creates a writable stream that stores data in memory. You can write data to it and then convert it to a string.

const MemoryStream = require('memory-streams');
const writableStream = new MemoryStream.WritableStream();
writableStream.write('Hello, ');
writableStream.write('world!');
writableStream.end();
console.log(writableStream.toString()); // Outputs: 'Hello, world!'

ReadableStream

Creates a readable stream from a string. You can read data from it as you would with any other readable stream.

const MemoryStream = require('memory-streams');
const readableStream = new MemoryStream.ReadableStream('Hello, world!');
readableStream.on('data', (chunk) => {
  console.log(chunk.toString()); // Outputs: 'Hello, world!'
});

DuplexStream

Creates a duplex stream that can be both readable and writable. You can write data to it and read data from it.

const MemoryStream = require('memory-streams');
const duplexStream = new MemoryStream.DuplexStream();
duplexStream.write('Hello, ');
duplexStream.write('world!');
duplexStream.end();
duplexStream.on('data', (chunk) => {
  console.log(chunk.toString()); // Outputs: 'Hello, world!'
});

Other packages similar to memory-streams

Keywords

FAQs

Package last updated on 05 Feb 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc