New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

promisify-stream-chunks

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promisify-stream-chunks

All chunks in a stream are sent to a callback which returns a promise. The next chunk will not be processed before the previous chunk's promise is resolved.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Build Status

promisify-stream-chunks

All chunks in an object stream are sent to a callback which returns a promise. The next chunk will not be processed before the previous chunk's promise is resolved.

  • Works on object streams only.

How?

const promisifyStreamChunks = require('promisify-stream-chunks');

const rs = new Readable({ objectMode: true });
rs.push({ test: 'first' });
rs.push({ test: 'second' });
rs.push({ test: 'third' });
rs.push(null);

rs.pipe(promisifyStreamChunks(chunk => {

	return new Promise((resolve, reject) => {
		doAsyncThings(chunk, () => {
			resolve();

			// If you want to transform the values in the stream, do:
			// resolve({ example: 'my data' });
		});

	});

});

Roadmap

  • We should have a way of handling rejects/errors. Right now, they are only outputed to stderr.

FAQs

Package last updated on 11 Apr 2017

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