New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gulp-inject-self

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

gulp-inject-self

A gulp plugin that injects self stream to a destination file.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

gulp-inject-self

A Gulp that injects self stream to a destination file.

for stream.txt:

my own file

and for dest.txt:

dest
insert here
dest

the code

var injectSelf = require('gulp-inject-self');
gulp.task('inject', function(){
   return gulp.src('stream.txt')
      .pipe(injectSelf('dest.txt', /insert here/))
      .pipe(gulp.dest('.'));
}

outputs stream.txt with the content:

dest
my own file
dest

and the code

var injectSelf = require('gulp-inject-self');
gulp.task('inject', function(){
   return gulp.src('stream.txt')
      .pipe(injectSelf('dest.txt', /insert here/, {
           replaceWith: function(fileContent){
               return '$&\n' + fileContent; //the string being replaced, new line, file content from the stream
           }
      }))
      .pipe(gulp.dest('.'));
}

outputs stream.txt with the content:

dest
insert here
my own file
dest

Getting Started

This plugin requires Gulp ~3.5.5

If you haven't used Gulp before, be sure to check out the Getting Started guide, as it explains how to create a Gulpfile as well as install and use Gulp plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install gulp-inject-self --save-dev

Once the plugin has been installed, it should be required inside your Gulpfile:

var injectSelf = require('gulp-inject-self');

Options

options.replaceWith

Type: Function Default value: function(contents){ return contents; }

Preprocessing the contents of file from the gulp stream when replace is applied on the target file.

options.skipBinary

Type: Boolean Default value: false

Should binary files be skipped.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Gulp.

Release History

  • 0.0.1 - initial release.
  • 1.0.0 - added tests, fixed bugs.

License

MIT

Keywords

FAQs

Package last updated on 29 Sep 2015

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