Socket
Book a DemoInstallSign in
Socket

sprom

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sprom

Convert node.js Streams into Promises

Source
npmnpm
Version
2.0.3
Version published
Weekly downloads
2
-89.47%
Maintainers
2
Weekly downloads
 
Created
Source

sprom

Convert node.js Streams into Promises

Build Status Dependency Status

Installation

$ npm install sprom

Usage

sprom.end(request(url).pipe(fs.createWriteStream('file.json')))
  .then(function () {
    console.log('Successfully wrote file');
  }, function (err) {
    console.error('Failed to write file');
    console.error(err.stack || err.message || err);
  });
sprom(request(url))
  .then(function (body) {
    console.dir(JSON.parse(body.toString()));
  })
  .then(null, function (err) {
    console.error('Failed to read JSON');
    console.error(err.stack || err.message || err);
  });

API

sprom.end(stream)

Get a promise that is resolved when the stream has ended. This won't make any attempt to look at the data of the stream.

sprom.buf(stream)

Get a promise that buffers the contents of the stream using concat-stream and then returns a promise for the concatenated results.

License

MIT

FAQs

Package last updated on 06 May 2014

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