You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

gulp-intercept

Package Overview
Dependencies
1
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-intercept

Intercept Gulp streams and take full control of the content.


Version published
Weekly downloads
797
increased by11.94%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

gulp-intercept

Gulp plugin to intercept a Gulp stream.

The plugin accepts a function with a single argument - a chunk or file. Do whatever you need to eg. parse the file if its json, convert it if less or coffeescript or simply perform an update to its contents.

Usage

  • Install - npm install gulp-intercept --save-dev
  • Update your gulpfile.js:
var intercept = require('./gulp-intercept');
var concat = require('gulp-concat');

gulp.task('task', function () {
  gulp.src(['./*.txt'])
    .pipe(intercept(function(file){
      console.log('FILE: ' + file.path );
      console.log('OLD CONTENT: ' + file.contents.toString() );
      file.contents = new Buffer( "Hello!!!" );
      console.log('NEW CONTENT: ' + file.contents.toString() );
      return file;
    })) 
    .pipe(concat('onefile.txt'))
    .pipe(gulp.dest('./'));
});

API

intercept( method )

Type: Function method - Is a function that accepts a File and returns a File.

function ( file ) {
  // do stuff
  return file;
}

Keywords

FAQs

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc