function ReplaceStringTransform(str, value) {
	if (!(this instanceof ReplaceStringTransform)) {
		  return new ReplaceStringTransform(options);
	  }
	
	Transform.call(this);
	this._str = str;
	this._length = this._str.length;
	this._value = value == null ? '' : value + '';
	this._rest = '';
}
Example #2
0
function FileWriterTransform(writer, source, isRaw, req) {
	if (!(this instanceof FileWriterTransform)) {
		  return new FileWriterTransform(options);
	  }
	var self = this;
	Transform.call(self);
	self._writer = writer;
	source.on('error', function() {
		writer.end();
	});
	isRaw && writer.write(getRawData(source, req));
}
Example #3
0
function SpeedTransform(options) {
  if (!(this instanceof SpeedTransform)) {
    return new SpeedTransform(options);
  }

  Transform.call(this);
  options = options || {};
  var value = parseInt(options.speed * 1000 / 8);
  if (value > 0) {
    this._speed = value;
  }
  if ((value = parseInt(options.delay)) > 0) {
    this._delay = value;
  }
}
Example #4
0
function WhistleTransform(options) {
  if (!(this instanceof WhistleTransform)) {
    return new WhistleTransform(options);
  }

  Transform.call(this);
  options = options || {};
  var value = parseInt(options.speed * 1000 / 8);
  if (value > 0) {
    this._speed = value;
  }
  if ((value = parseInt(options.delay)) > 0) {
    this._delay = value;
  }

  var charset = options.charset && String(options.charset);
  if (!iconv.encodingExists(charset)) {
    charset = 'utf8';
  }

  this._body = getBuffer(options, 'body', charset);
  this._top = getBuffer(options, 'top', charset);
  this._bottom = getBuffer(options, 'bottom', charset);
}
function ReplacePatternTransform(pattern, value) {
  Transform.call(this);
  this._pattern = pattern;
  this._value = value == null ? '' : value + '';
  this._rest = '';
}