stream-injecter

Stream-injection ===============

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
stream-injecter
0.0.110 years ago10 years agoMinified + gzip package size for stream-injecter in KB

Readme

Stream-injection
This module allows string to stream.

Usage

var fs = require('fs');
var StreamInjecter = require('stream-injecter');

var snippet = "\n<script type=\"text/javascript\">document.write('<script src=\"abc.js\" type=\"text/javascript\"><\\/script>')</script>\n";
var stream = fs.createReadStream("./index.html");

var injecter = new StreamInjecter({
  matchRegExp : /(<\/body>)/,
  inject : snippet,
  replace : snippet + "$1",
  ignore : /livereload.js/
});

stream.pipe(injecter).pipe(process.stdout);