Socket
Socket
Sign inDemoInstall

gulp-streamify

Package Overview
Dependencies
10
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gulp-streamify

Wrap old plugins to support streams.


Version published
Weekly downloads
9.6K
decreased by-0.63%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

gulp-streamify

Wrap old Gulp plugins to support streams.

NPM version Build status Dependency Status devDependency Status Coverage Status

It is pretty annoying when Gulp plugins doesn't support streams. This plugin allows you to wrap them in order to use the stream mode anyway. It is pretty useful when you want to take advantage of streams on part of your pipelines.

Note to gulp plugin developpers: This plugin should not discourage you to support streams in your own plugins. I made this plug-in to avoid beeing stucked with a bad plugin. If your underlying library support streams, please, use it! Even if it doesn't, use BufferStreams in your plugins to support streams at the plugin level (it won't block files to buffer their contents like this library has to do to work). Here is a sample of bufferstreams usage in Gulp plugins.

Usage

First, install gulp-streamify as a development dependency:

npm install --save-dev gulp-streamify

Then, add it to your gulpfile.js and wrap all that shit:

var streamify = require('gulp-streamify');
var noStreamPlugin = require('gulp-no-stream');

gulp.task('stream', function(){
  gulp.src(['**/*'])
    .pipe( streamify( noStreamPlugin() ) )
    .pipe(gulp.dest('/tmp'));
});

If you have several plugins to wrap together, prefer calling gulp-streamify once thanks to the function form of the gulp-streamify constructor:

var gStreamify = require('gulp-streamify');
var noStreamPlugin = require('gulp-no-stream');
var noStreamPlugin2 = require('gulp-no-stream2');
var plexer = require('plexer');

gulp.task('stream', function(){
  gulp.src(['**/*'])
    .pipe(streamify(function() {
      var instream = noStreamPlugin();
      var outstream = noStreamPlugin2();
      instream
        .pipe(anyOtherStream)
        .pipe(outStream);
      return plexer(instream, outstream);
    }))
    .pipe(gulp.dest('/tmp'));
});

API

stream : streamify(toBeWrap)

Take a stream or a function returning a stream to wrap an return a stream mode compatible stream.

Contributing / Issues

You may want to contribute to this project, pull requests are welcome if you accept to publish under the MIT licence.

Keywords

FAQs

Last updated on 07 Sep 2015

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc