Socket
Socket
Sign inDemoInstall

convert-stream

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    convert-stream

Convert stream in node.js to buffer or array


Version published
Maintainers
1
Install size
622 kB
Created

Readme

Source

convert-stream

Converts any stream to buffer or an array. Saves you from the trouble of saveing the streams to files.

Features

  • Fast
  • Promises implementation

Requirements

Before using gifme, please install:

  • Node.js

Installation

For local

npm install convert-stream --save

Usage

For converting to Buffer

const cs = require('convert-stream');
const fs = require('fs');
const path = require('path');

let input = path.join(__dirname, 'yourexamplefile');

let yourStream = fs.createReadStream(input);
cs.toBuffer(yourStream)
    .then((returnedBuffer) => { /*doSomething*/ })
    .catch(err, function doSomthingWithError(error) { /*do something*/ });

For converting to array

cs.toArray(yourStream)
    .then((returnedArray) => { /*doSomething*/ })
    .catch(err, function doSomthingWithError(error) { /*do something*/ });

Keywords

FAQs

Last updated on 02 Aug 2016

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc