IOStreams
Quick amnd easy input & output streams from a bit of JSON.
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