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

streamit

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

streamit

streamIt a readable stream (node 0.10+) variant taking Buffer or Stream inputs

latest
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

streamit

streamIt is a variant of nodejs stream2 readable class ( http://nodejs.org/api/stream.html ; http://nodejs.org/api/stream.html#stream_class_stream_readable ) streamIt will take Buffers or streams as input and stream them to a output with definable encoding and chunkSize( === highWaterMark ).

var outStream = new streamit(dataToSend, encoding, chunkSize);
	outStream.pipe(res);

a typical use case would be piping of a in-memory buffer to a http.res:

  • installing
    npm install streamit
  • buffer as input. encoding will be default ('utf8') and chunkSize will be default (16kb)
    var dataToSend = new Buffer(104857600); //100mb
    var stream = new streamit(dataToSend);
    stream.on(
    	'end',
    	function() {
    		process.nextTick(
    			function() {
    				res.end();
    			}
    		);
    		return;
    	}
    );
    stream.pipe(res);
  • stream as input. actively setting encoding to 'binary' and chunkSize to 64kb
    var dataToSend = fs.createReadStream('./someimage.png', 'binary', 65536);
    var stream = new streamit(dataToSend);
    stream.on(
    	'end',
    	function() {
    		process.nextTick(
    			function() {
    				res.end();
    			}
    		);
    		return;
    	}
    );
    stream.pipe(res);

VERSION

v 0.1.1

author

Toni Wagner

#Licence

free

FAQs

Package last updated on 19 Sep 2013

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