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

get-stream

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-stream

Get a stream as a string, buffer, or array

  • 2.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is get-stream?

The get-stream npm package is a utility that allows you to get a stream as a string, buffer, or array. It is useful for converting streams into a more usable form in Node.js applications.

What are get-stream's main functionalities?

Get stream as a string

This feature allows you to convert a readable stream into a string. It is useful when you want to process the contents of a file or any readable stream as a string.

const getStream = require('get-stream');
const fs = require('fs');

(async () => {
  const stream = fs.createReadStream('file.txt');
  const data = await getStream(stream);
  console.log(data);
})();

Get stream as a buffer

This feature allows you to convert a readable stream into a buffer. It is useful when you need to handle binary data from streams.

const getStream = require('get-stream');
const fs = require('fs');

(async () => {
  const stream = fs.createReadStream('file.txt');
  const data = await getStream.buffer(stream);
  console.log(data);
})();

Get stream as an array

This feature allows you to convert a readable stream into an array of values. It is useful when you want to process data from a stream in chunks or lines.

const getStream = require('get-stream');
const fs = require('fs');

(async () => {
  const stream = fs.createReadStream('file.txt');
  const data = await getStream.array(stream);
  console.log(data);
})();

Other packages similar to get-stream

Keywords

FAQs

Package last updated on 28 Apr 2016

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