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

string-to-stream

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

string-to-stream

Convert a string into a stream (streams2)

  • 3.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
329K
increased by17.05%
Maintainers
1
Weekly downloads
 
Created

What is string-to-stream?

The string-to-stream npm package allows you to convert strings into readable streams in Node.js. This can be useful for various tasks such as processing large strings in a memory-efficient way, simulating file streams, or piping string data into other stream-based APIs.

What are string-to-stream's main functionalities?

Convert String to Readable Stream

This feature allows you to convert a string into a readable stream. In the code sample, the string 'Hello, World!' is converted into a readable stream and then piped to the standard output.

const stringToStream = require('string-to-stream');
const readableStream = stringToStream('Hello, World!');
readableStream.pipe(process.stdout);

Pipe String Data to Writable Stream

This feature demonstrates how to pipe string data into a writable stream, such as a file. The string 'Hello, File!' is converted into a readable stream and then piped into a writable stream that writes to 'output.txt'.

const stringToStream = require('string-to-stream');
const fs = require('fs');
const readableStream = stringToStream('Hello, File!');
const writableStream = fs.createWriteStream('output.txt');
readableStream.pipe(writableStream);

Other packages similar to string-to-stream

Keywords

FAQs

Package last updated on 26 Aug 2019

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