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

read-all-stream

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

read-all-stream

Read all stream content and pass it to callback

  • 3.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
176K
decreased by-30.18%
Maintainers
1
Weekly downloads
 
Created

What is read-all-stream?

The 'read-all-stream' npm package is a utility that allows you to read all data from a stream until the end. It is particularly useful for handling streams in Node.js, such as reading data from files, HTTP responses, or any other stream-based data source.

What are read-all-stream's main functionalities?

Read all data from a stream

This feature allows you to read all data from a stream until the end. In this example, it reads the entire content of 'example.txt' and logs it to the console.

const readAllStream = require('read-all-stream');
const fs = require('fs');

const stream = fs.createReadStream('example.txt');

readAllStream(stream, 'utf8', (err, data) => {
  if (err) throw err;
  console.log(data);
});

Read all data from a stream with a promise

This feature allows you to read all data from a stream using a promise. It provides a more modern approach to handling asynchronous operations. In this example, it reads the entire content of 'example.txt' and logs it to the console.

const readAllStream = require('read-all-stream');
const fs = require('fs');

const stream = fs.createReadStream('example.txt');

readAllStream(stream, 'utf8').then(data => {
  console.log(data);
}).catch(err => {
  console.error(err);
});

Other packages similar to read-all-stream

Keywords

FAQs

Package last updated on 27 Jan 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