Firebase Update
This commit is contained in:
		
							
								
								
									
										19
									
								
								express-server/node_modules/combined-stream/License
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								express-server/node_modules/combined-stream/License
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
Copyright (c) 2011 Debuggable Limited <felix@debuggable.com>
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
in the Software without restriction, including without limitation the rights
 | 
			
		||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
furnished to do so, subject to the following conditions:
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in
 | 
			
		||||
all copies or substantial portions of the Software.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
			
		||||
THE SOFTWARE.
 | 
			
		||||
							
								
								
									
										138
									
								
								express-server/node_modules/combined-stream/Readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										138
									
								
								express-server/node_modules/combined-stream/Readme.md
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,138 @@
 | 
			
		||||
# combined-stream
 | 
			
		||||
 | 
			
		||||
A stream that emits multiple other streams one after another.
 | 
			
		||||
 | 
			
		||||
**NB** Currently `combined-stream` works with streams version 1 only. There is ongoing effort to switch this library to streams version 2. Any help is welcome. :) Meanwhile you can explore other libraries that provide streams2 support with more or less compatibility with `combined-stream`.
 | 
			
		||||
 | 
			
		||||
- [combined-stream2](https://www.npmjs.com/package/combined-stream2): A drop-in streams2-compatible replacement for the combined-stream module.
 | 
			
		||||
 | 
			
		||||
- [multistream](https://www.npmjs.com/package/multistream): A stream that emits multiple other streams one after another.
 | 
			
		||||
 | 
			
		||||
## Installation
 | 
			
		||||
 | 
			
		||||
``` bash
 | 
			
		||||
npm install combined-stream
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
Here is a simple example that shows how you can use combined-stream to combine
 | 
			
		||||
two files into one:
 | 
			
		||||
 | 
			
		||||
``` javascript
 | 
			
		||||
var CombinedStream = require('combined-stream');
 | 
			
		||||
var fs = require('fs');
 | 
			
		||||
 | 
			
		||||
var combinedStream = CombinedStream.create();
 | 
			
		||||
combinedStream.append(fs.createReadStream('file1.txt'));
 | 
			
		||||
combinedStream.append(fs.createReadStream('file2.txt'));
 | 
			
		||||
 | 
			
		||||
combinedStream.pipe(fs.createWriteStream('combined.txt'));
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
While the example above works great, it will pause all source streams until
 | 
			
		||||
they are needed. If you don't want that to happen, you can set `pauseStreams`
 | 
			
		||||
to `false`:
 | 
			
		||||
 | 
			
		||||
``` javascript
 | 
			
		||||
var CombinedStream = require('combined-stream');
 | 
			
		||||
var fs = require('fs');
 | 
			
		||||
 | 
			
		||||
var combinedStream = CombinedStream.create({pauseStreams: false});
 | 
			
		||||
combinedStream.append(fs.createReadStream('file1.txt'));
 | 
			
		||||
combinedStream.append(fs.createReadStream('file2.txt'));
 | 
			
		||||
 | 
			
		||||
combinedStream.pipe(fs.createWriteStream('combined.txt'));
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
However, what if you don't have all the source streams yet, or you don't want
 | 
			
		||||
to allocate the resources (file descriptors, memory, etc.) for them right away?
 | 
			
		||||
Well, in that case you can simply provide a callback that supplies the stream
 | 
			
		||||
by calling a `next()` function:
 | 
			
		||||
 | 
			
		||||
``` javascript
 | 
			
		||||
var CombinedStream = require('combined-stream');
 | 
			
		||||
var fs = require('fs');
 | 
			
		||||
 | 
			
		||||
var combinedStream = CombinedStream.create();
 | 
			
		||||
combinedStream.append(function(next) {
 | 
			
		||||
  next(fs.createReadStream('file1.txt'));
 | 
			
		||||
});
 | 
			
		||||
combinedStream.append(function(next) {
 | 
			
		||||
  next(fs.createReadStream('file2.txt'));
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
combinedStream.pipe(fs.createWriteStream('combined.txt'));
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## API
 | 
			
		||||
 | 
			
		||||
### CombinedStream.create([options])
 | 
			
		||||
 | 
			
		||||
Returns a new combined stream object. Available options are:
 | 
			
		||||
 | 
			
		||||
* `maxDataSize`
 | 
			
		||||
* `pauseStreams`
 | 
			
		||||
 | 
			
		||||
The effect of those options is described below.
 | 
			
		||||
 | 
			
		||||
### combinedStream.pauseStreams = `true`
 | 
			
		||||
 | 
			
		||||
Whether to apply back pressure to the underlaying streams. If set to `false`,
 | 
			
		||||
the underlaying streams will never be paused. If set to `true`, the
 | 
			
		||||
underlaying streams will be paused right after being appended, as well as when
 | 
			
		||||
`delayedStream.pipe()` wants to throttle.
 | 
			
		||||
 | 
			
		||||
### combinedStream.maxDataSize = `2 * 1024 * 1024`
 | 
			
		||||
 | 
			
		||||
The maximum amount of bytes (or characters) to buffer for all source streams.
 | 
			
		||||
If this value is exceeded, `combinedStream` emits an `'error'` event.
 | 
			
		||||
 | 
			
		||||
### combinedStream.dataSize = `0`
 | 
			
		||||
 | 
			
		||||
The amount of bytes (or characters) currently buffered by `combinedStream`.
 | 
			
		||||
 | 
			
		||||
### combinedStream.append(stream)
 | 
			
		||||
 | 
			
		||||
Appends the given `stream` to the combinedStream object. If `pauseStreams` is
 | 
			
		||||
set to `true, this stream will also be paused right away.
 | 
			
		||||
 | 
			
		||||
`streams` can also be a function that takes one parameter called `next`. `next`
 | 
			
		||||
is a function that must be invoked in order to provide the `next` stream, see
 | 
			
		||||
example above.
 | 
			
		||||
 | 
			
		||||
Regardless of how the `stream` is appended, combined-stream always attaches an
 | 
			
		||||
`'error'` listener to it, so you don't have to do that manually.
 | 
			
		||||
 | 
			
		||||
Special case: `stream` can also be a String or Buffer.
 | 
			
		||||
 | 
			
		||||
### combinedStream.write(data)
 | 
			
		||||
 | 
			
		||||
You should not call this, `combinedStream` takes care of piping the appended
 | 
			
		||||
streams into itself for you.
 | 
			
		||||
 | 
			
		||||
### combinedStream.resume()
 | 
			
		||||
 | 
			
		||||
Causes `combinedStream` to start drain the streams it manages. The function is
 | 
			
		||||
idempotent, and also emits a `'resume'` event each time which usually goes to
 | 
			
		||||
the stream that is currently being drained.
 | 
			
		||||
 | 
			
		||||
### combinedStream.pause();
 | 
			
		||||
 | 
			
		||||
If `combinedStream.pauseStreams` is set to `false`, this does nothing.
 | 
			
		||||
Otherwise a `'pause'` event is emitted, this goes to the stream that is
 | 
			
		||||
currently being drained, so you can use it to apply back pressure.
 | 
			
		||||
 | 
			
		||||
### combinedStream.end();
 | 
			
		||||
 | 
			
		||||
Sets `combinedStream.writable` to false, emits an `'end'` event, and removes
 | 
			
		||||
all streams from the queue.
 | 
			
		||||
 | 
			
		||||
### combinedStream.destroy();
 | 
			
		||||
 | 
			
		||||
Same as `combinedStream.end()`, except it emits a `'close'` event instead of
 | 
			
		||||
`'end'`.
 | 
			
		||||
 | 
			
		||||
## License
 | 
			
		||||
 | 
			
		||||
combined-stream is licensed under the MIT license.
 | 
			
		||||
							
								
								
									
										189
									
								
								express-server/node_modules/combined-stream/lib/combined_stream.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										189
									
								
								express-server/node_modules/combined-stream/lib/combined_stream.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,189 @@
 | 
			
		||||
var util = require('util');
 | 
			
		||||
var Stream = require('stream').Stream;
 | 
			
		||||
var DelayedStream = require('delayed-stream');
 | 
			
		||||
var defer = require('./defer.js');
 | 
			
		||||
 | 
			
		||||
module.exports = CombinedStream;
 | 
			
		||||
function CombinedStream() {
 | 
			
		||||
  this.writable = false;
 | 
			
		||||
  this.readable = true;
 | 
			
		||||
  this.dataSize = 0;
 | 
			
		||||
  this.maxDataSize = 2 * 1024 * 1024;
 | 
			
		||||
  this.pauseStreams = true;
 | 
			
		||||
 | 
			
		||||
  this._released = false;
 | 
			
		||||
  this._streams = [];
 | 
			
		||||
  this._currentStream = null;
 | 
			
		||||
}
 | 
			
		||||
util.inherits(CombinedStream, Stream);
 | 
			
		||||
 | 
			
		||||
CombinedStream.create = function(options) {
 | 
			
		||||
  var combinedStream = new this();
 | 
			
		||||
 | 
			
		||||
  options = options || {};
 | 
			
		||||
  for (var option in options) {
 | 
			
		||||
    combinedStream[option] = options[option];
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return combinedStream;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CombinedStream.isStreamLike = function(stream) {
 | 
			
		||||
  return (typeof stream !== 'function')
 | 
			
		||||
    && (typeof stream !== 'string')
 | 
			
		||||
    && (typeof stream !== 'boolean')
 | 
			
		||||
    && (typeof stream !== 'number')
 | 
			
		||||
    && (!Buffer.isBuffer(stream));
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CombinedStream.prototype.append = function(stream) {
 | 
			
		||||
  var isStreamLike = CombinedStream.isStreamLike(stream);
 | 
			
		||||
 | 
			
		||||
  if (isStreamLike) {
 | 
			
		||||
    if (!(stream instanceof DelayedStream)) {
 | 
			
		||||
      var newStream = DelayedStream.create(stream, {
 | 
			
		||||
        maxDataSize: Infinity,
 | 
			
		||||
        pauseStream: this.pauseStreams,
 | 
			
		||||
      });
 | 
			
		||||
      stream.on('data', this._checkDataSize.bind(this));
 | 
			
		||||
      stream = newStream;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this._handleErrors(stream);
 | 
			
		||||
 | 
			
		||||
    if (this.pauseStreams) {
 | 
			
		||||
      stream.pause();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  this._streams.push(stream);
 | 
			
		||||
  return this;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CombinedStream.prototype.pipe = function(dest, options) {
 | 
			
		||||
  Stream.prototype.pipe.call(this, dest, options);
 | 
			
		||||
  this.resume();
 | 
			
		||||
  return dest;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CombinedStream.prototype._getNext = function() {
 | 
			
		||||
  this._currentStream = null;
 | 
			
		||||
  var stream = this._streams.shift();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  if (typeof stream == 'undefined') {
 | 
			
		||||
    this.end();
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (typeof stream !== 'function') {
 | 
			
		||||
    this._pipeNext(stream);
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  var getStream = stream;
 | 
			
		||||
  getStream(function(stream) {
 | 
			
		||||
    var isStreamLike = CombinedStream.isStreamLike(stream);
 | 
			
		||||
    if (isStreamLike) {
 | 
			
		||||
      stream.on('data', this._checkDataSize.bind(this));
 | 
			
		||||
      this._handleErrors(stream);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    defer(this._pipeNext.bind(this, stream));
 | 
			
		||||
  }.bind(this));
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CombinedStream.prototype._pipeNext = function(stream) {
 | 
			
		||||
  this._currentStream = stream;
 | 
			
		||||
 | 
			
		||||
  var isStreamLike = CombinedStream.isStreamLike(stream);
 | 
			
		||||
  if (isStreamLike) {
 | 
			
		||||
    stream.on('end', this._getNext.bind(this));
 | 
			
		||||
    stream.pipe(this, {end: false});
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  var value = stream;
 | 
			
		||||
  this.write(value);
 | 
			
		||||
  this._getNext();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CombinedStream.prototype._handleErrors = function(stream) {
 | 
			
		||||
  var self = this;
 | 
			
		||||
  stream.on('error', function(err) {
 | 
			
		||||
    self._emitError(err);
 | 
			
		||||
  });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CombinedStream.prototype.write = function(data) {
 | 
			
		||||
  this.emit('data', data);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CombinedStream.prototype.pause = function() {
 | 
			
		||||
  if (!this.pauseStreams) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause();
 | 
			
		||||
  this.emit('pause');
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CombinedStream.prototype.resume = function() {
 | 
			
		||||
  if (!this._released) {
 | 
			
		||||
    this._released = true;
 | 
			
		||||
    this.writable = true;
 | 
			
		||||
    this._getNext();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume();
 | 
			
		||||
  this.emit('resume');
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CombinedStream.prototype.end = function() {
 | 
			
		||||
  this._reset();
 | 
			
		||||
  this.emit('end');
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CombinedStream.prototype.destroy = function() {
 | 
			
		||||
  this._reset();
 | 
			
		||||
  this.emit('close');
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CombinedStream.prototype._reset = function() {
 | 
			
		||||
  this.writable = false;
 | 
			
		||||
  this._streams = [];
 | 
			
		||||
  this._currentStream = null;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CombinedStream.prototype._checkDataSize = function() {
 | 
			
		||||
  this._updateDataSize();
 | 
			
		||||
  if (this.dataSize <= this.maxDataSize) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  var message =
 | 
			
		||||
    'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.';
 | 
			
		||||
  this._emitError(new Error(message));
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CombinedStream.prototype._updateDataSize = function() {
 | 
			
		||||
  this.dataSize = 0;
 | 
			
		||||
 | 
			
		||||
  var self = this;
 | 
			
		||||
  this._streams.forEach(function(stream) {
 | 
			
		||||
    if (!stream.dataSize) {
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    self.dataSize += stream.dataSize;
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  if (this._currentStream && this._currentStream.dataSize) {
 | 
			
		||||
    this.dataSize += this._currentStream.dataSize;
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
CombinedStream.prototype._emitError = function(err) {
 | 
			
		||||
  this._reset();
 | 
			
		||||
  this.emit('error', err);
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										26
									
								
								express-server/node_modules/combined-stream/lib/defer.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								express-server/node_modules/combined-stream/lib/defer.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
module.exports = defer;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Runs provided function on next iteration of the event loop
 | 
			
		||||
 *
 | 
			
		||||
 * @param {function} fn - function to run
 | 
			
		||||
 */
 | 
			
		||||
function defer(fn)
 | 
			
		||||
{
 | 
			
		||||
  var nextTick = typeof setImmediate == 'function'
 | 
			
		||||
    ? setImmediate
 | 
			
		||||
    : (
 | 
			
		||||
      typeof process == 'object' && typeof process.nextTick == 'function'
 | 
			
		||||
      ? process.nextTick
 | 
			
		||||
      : null
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
  if (nextTick)
 | 
			
		||||
  {
 | 
			
		||||
    nextTick(fn);
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    setTimeout(fn, 0);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										58
									
								
								express-server/node_modules/combined-stream/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								express-server/node_modules/combined-stream/package.json
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,58 @@
 | 
			
		||||
{
 | 
			
		||||
  "_from": "combined-stream@~1.0.6",
 | 
			
		||||
  "_id": "combined-stream@1.0.7",
 | 
			
		||||
  "_inBundle": false,
 | 
			
		||||
  "_integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==",
 | 
			
		||||
  "_location": "/combined-stream",
 | 
			
		||||
  "_phantomChildren": {},
 | 
			
		||||
  "_requested": {
 | 
			
		||||
    "type": "range",
 | 
			
		||||
    "registry": true,
 | 
			
		||||
    "raw": "combined-stream@~1.0.6",
 | 
			
		||||
    "name": "combined-stream",
 | 
			
		||||
    "escapedName": "combined-stream",
 | 
			
		||||
    "rawSpec": "~1.0.6",
 | 
			
		||||
    "saveSpec": null,
 | 
			
		||||
    "fetchSpec": "~1.0.6"
 | 
			
		||||
  },
 | 
			
		||||
  "_requiredBy": [
 | 
			
		||||
    "/form-data",
 | 
			
		||||
    "/request"
 | 
			
		||||
  ],
 | 
			
		||||
  "_resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz",
 | 
			
		||||
  "_shasum": "2d1d24317afb8abe95d6d2c0b07b57813539d828",
 | 
			
		||||
  "_spec": "combined-stream@~1.0.6",
 | 
			
		||||
  "_where": "D:\\Desktop\\Git\\Firebase\\SmartShopperFirebase\\node_modules\\request",
 | 
			
		||||
  "author": {
 | 
			
		||||
    "name": "Felix Geisendörfer",
 | 
			
		||||
    "email": "felix@debuggable.com",
 | 
			
		||||
    "url": "http://debuggable.com/"
 | 
			
		||||
  },
 | 
			
		||||
  "bugs": {
 | 
			
		||||
    "url": "https://github.com/felixge/node-combined-stream/issues"
 | 
			
		||||
  },
 | 
			
		||||
  "bundleDependencies": false,
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "delayed-stream": "~1.0.0"
 | 
			
		||||
  },
 | 
			
		||||
  "deprecated": false,
 | 
			
		||||
  "description": "A stream that emits multiple other streams one after another.",
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "far": "~0.0.7"
 | 
			
		||||
  },
 | 
			
		||||
  "engines": {
 | 
			
		||||
    "node": ">= 0.8"
 | 
			
		||||
  },
 | 
			
		||||
  "homepage": "https://github.com/felixge/node-combined-stream",
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
  "main": "./lib/combined_stream",
 | 
			
		||||
  "name": "combined-stream",
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
    "url": "git://github.com/felixge/node-combined-stream.git"
 | 
			
		||||
  },
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "test": "node test/run.js"
 | 
			
		||||
  },
 | 
			
		||||
  "version": "1.0.7"
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user