Updated the Survey.
This commit is contained in:
		
							parent
							
								
									f59686eae0
								
							
						
					
					
						commit
						6d3ba1a714
					
				
					 1203 changed files with 140782 additions and 5 deletions
				
			
		
							
								
								
									
										21
									
								
								node_modules/clone-response/LICENSE
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								node_modules/clone-response/LICENSE
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,21 @@
 | 
			
		|||
MIT License
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2017 Luke Childs
 | 
			
		||||
 | 
			
		||||
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.
 | 
			
		||||
							
								
								
									
										62
									
								
								node_modules/clone-response/README.md
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								node_modules/clone-response/README.md
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,62 @@
 | 
			
		|||
# clone-response
 | 
			
		||||
 | 
			
		||||
> Clone a Node.js HTTP response stream
 | 
			
		||||
 | 
			
		||||
[](https://travis-ci.org/lukechilds/clone-response)
 | 
			
		||||
[](https://coveralls.io/github/lukechilds/clone-response?branch=master)
 | 
			
		||||
[](https://www.npmjs.com/package/clone-response)
 | 
			
		||||
[](https://www.npmjs.com/package/clone-response)
 | 
			
		||||
 | 
			
		||||
Returns a new stream and copies over all properties and methods from the original response giving you a complete duplicate.
 | 
			
		||||
 | 
			
		||||
This is useful in situations where you need to consume the response stream but also want to pass an unconsumed stream somewhere else to be consumed later.
 | 
			
		||||
 | 
			
		||||
## Install
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
npm install --save clone-response
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
const http = require('http');
 | 
			
		||||
const cloneResponse = require('clone-response');
 | 
			
		||||
 | 
			
		||||
http.get('http://example.com', response => {
 | 
			
		||||
  const clonedResponse = cloneResponse(response);
 | 
			
		||||
  response.pipe(process.stdout);
 | 
			
		||||
 | 
			
		||||
  setImmediate(() => {
 | 
			
		||||
    // The response stream has already been consumed by the time this executes,
 | 
			
		||||
    // however the cloned response stream is still available.
 | 
			
		||||
    doSomethingWithResponse(clonedResponse);
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Please bear in mind that the process of cloning a stream consumes it. However, you can consume a stream multiple times in the same tick, therefore allowing you to create multiple clones. e.g:
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
const clone1 = cloneResponse(response);
 | 
			
		||||
const clone2 = cloneResponse(response);
 | 
			
		||||
// response can still be consumed in this tick but cannot be consumed if passed
 | 
			
		||||
// into any async callbacks. clone1 and clone2 can be passed around and be
 | 
			
		||||
// consumed in the future.
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## API
 | 
			
		||||
 | 
			
		||||
### cloneResponse(response)
 | 
			
		||||
 | 
			
		||||
Returns a clone of the passed in response.
 | 
			
		||||
 | 
			
		||||
#### response
 | 
			
		||||
 | 
			
		||||
Type: `stream`
 | 
			
		||||
 | 
			
		||||
A [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage) to clone.
 | 
			
		||||
 | 
			
		||||
## License
 | 
			
		||||
 | 
			
		||||
MIT © Luke Childs
 | 
			
		||||
							
								
								
									
										73
									
								
								node_modules/clone-response/package.json
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								node_modules/clone-response/package.json
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,73 @@
 | 
			
		|||
{
 | 
			
		||||
  "_from": "clone-response@^1.0.2",
 | 
			
		||||
  "_id": "clone-response@1.0.2",
 | 
			
		||||
  "_inBundle": false,
 | 
			
		||||
  "_integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=",
 | 
			
		||||
  "_location": "/clone-response",
 | 
			
		||||
  "_phantomChildren": {},
 | 
			
		||||
  "_requested": {
 | 
			
		||||
    "type": "range",
 | 
			
		||||
    "registry": true,
 | 
			
		||||
    "raw": "clone-response@^1.0.2",
 | 
			
		||||
    "name": "clone-response",
 | 
			
		||||
    "escapedName": "clone-response",
 | 
			
		||||
    "rawSpec": "^1.0.2",
 | 
			
		||||
    "saveSpec": null,
 | 
			
		||||
    "fetchSpec": "^1.0.2"
 | 
			
		||||
  },
 | 
			
		||||
  "_requiredBy": [
 | 
			
		||||
    "/cacheable-request"
 | 
			
		||||
  ],
 | 
			
		||||
  "_resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz",
 | 
			
		||||
  "_shasum": "d1dc973920314df67fbeb94223b4ee350239e96b",
 | 
			
		||||
  "_spec": "clone-response@^1.0.2",
 | 
			
		||||
  "_where": "D:\\Documents\\UniWork\\Year 4\\Semester 2\\SEG3125\\Labs\\Lab 6\\Survey_Analysis\\node_modules\\cacheable-request",
 | 
			
		||||
  "author": {
 | 
			
		||||
    "name": "Luke Childs",
 | 
			
		||||
    "email": "lukechilds123@gmail.com",
 | 
			
		||||
    "url": "http://lukechilds.co.uk"
 | 
			
		||||
  },
 | 
			
		||||
  "bugs": {
 | 
			
		||||
    "url": "https://github.com/lukechilds/clone-response/issues"
 | 
			
		||||
  },
 | 
			
		||||
  "bundleDependencies": false,
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "mimic-response": "^1.0.0"
 | 
			
		||||
  },
 | 
			
		||||
  "deprecated": false,
 | 
			
		||||
  "description": "Clone a Node.js HTTP response stream",
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "ava": "^0.22.0",
 | 
			
		||||
    "coveralls": "^2.13.1",
 | 
			
		||||
    "create-test-server": "^2.0.1",
 | 
			
		||||
    "eslint-config-xo-lukechilds": "^1.0.0",
 | 
			
		||||
    "get-stream": "^3.0.0",
 | 
			
		||||
    "nyc": "^11.0.2",
 | 
			
		||||
    "pify": "^3.0.0",
 | 
			
		||||
    "xo": "^0.19.0"
 | 
			
		||||
  },
 | 
			
		||||
  "homepage": "https://github.com/lukechilds/clone-response",
 | 
			
		||||
  "keywords": [
 | 
			
		||||
    "clone",
 | 
			
		||||
    "duplicate",
 | 
			
		||||
    "copy",
 | 
			
		||||
    "response",
 | 
			
		||||
    "HTTP",
 | 
			
		||||
    "stream"
 | 
			
		||||
  ],
 | 
			
		||||
  "license": "MIT",
 | 
			
		||||
  "main": "src/index.js",
 | 
			
		||||
  "name": "clone-response",
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
    "url": "git+https://github.com/lukechilds/clone-response.git"
 | 
			
		||||
  },
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "coverage": "nyc report --reporter=text-lcov | coveralls",
 | 
			
		||||
    "test": "xo && nyc ava"
 | 
			
		||||
  },
 | 
			
		||||
  "version": "1.0.2",
 | 
			
		||||
  "xo": {
 | 
			
		||||
    "extends": "xo-lukechilds"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										17
									
								
								node_modules/clone-response/src/index.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								node_modules/clone-response/src/index.js
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
'use strict';
 | 
			
		||||
 | 
			
		||||
const PassThrough = require('stream').PassThrough;
 | 
			
		||||
const mimicResponse = require('mimic-response');
 | 
			
		||||
 | 
			
		||||
const cloneResponse = response => {
 | 
			
		||||
	if (!(response && response.pipe)) {
 | 
			
		||||
		throw new TypeError('Parameter `response` must be a response stream.');
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const clone = new PassThrough();
 | 
			
		||||
	mimicResponse(response, clone);
 | 
			
		||||
 | 
			
		||||
	return response.pipe(clone);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
module.exports = cloneResponse;
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue