Skip to content
Open input and output streams given providers and small config
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
.gitignore
.jshintrc
.travis.yml
Gruntfile.js
LICENSE
README.md
index.js
package.json

README.md

IOStreams

Quick and easy input & output streams from a bit of JSON.

Build Status Coverage Status Dependency Status

Example

Get an input stream from the filesystem, compile your stylus and output stream to S3.

iostreams.getInputOutputStreams(
  'file:' + __dirname + '/stylus/style.stylus',
  's3://mybucket.s3.amazonaws.com/css/style.css'
, function (err, inputStream, outputStream) {
  if(err) throw err;
  inputStream.pipe(require('gulp-stylus')).pipe(outputStream);
});

Usage

First you're going to need to import the module, and create an instance (by calling as a function):

var ioStreams = require('iostreams')();

Then add some providers

iostreams.use(require('iostreams-file'));
iostreams.use(require('iostreams-s3'));
iostreams.use(require('iostreams-http'));
iostreams.use(require('iostreams-https'));

Now you can use the three functions to get your input and output streams:

iostreams.getInputStream(config, function(err, inputStream) { });
iostreams.getOutputStream(config, function(err, outputStream) { });
iostreams.getInputOutputStreams(inputConfig, outputConfig, function(err, inputStream, outputStream) { });

config, inputConfig & outputConfig can be objects or URIs (strings).

Licence

MIT

Something went wrong with that request. Please try again.