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

easy-stream

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

easy-stream

```bash make test ```

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source
make test
/*
Thin wrapper that makes setting up streams a bit easier.
Defaults to objectMode on read and write streams. You can 
override options by including a config.options object.
*/

var Easy = require("easy-stream");


//creates a read stream
var easyReadStream = Easy({
  _read: function() {
    var someData = {
      easy: "stream"
    };
    this.push(someData);
  },
  options: {}  //using default options.
});

//now create a corresponding writable stream with easy-stream.
var easyWriteStream = Easy({
  _write: function(obj, encoding, next) {
    //obj is the json object {easy: "stream"}
    console.log(obj);
    next();
  }
});

easyReadStream.pipe(easyWriteStream);

//creating a duplex stream is easy.
var stream = Easy({
  _write: function() {},
  _read: function() {}
});

//so is creating a transform stream
var stream = Easy({
  _transform: function() {}
  _flush: function() {}
});

//you can subclass any function too
function SomeFunction() {}
SomeFunction.prototype.someMethod = function() {};

var easyDuplexStream = Easy({
  _read: function() {},
  _write: function() {},
  createUsing: SomeFunction
})

FAQs

Package last updated on 18 Feb 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

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