Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKat Marchán <kzm@zkat.tech>2018-07-11 00:54:34 +0300
committerKat Marchán <kzm@zkat.tech>2018-07-11 00:54:34 +0300
commitd9b2712a670e5e78334e83f89a5ed49616f1f3d3 (patch)
treedf79890df558bd30e485eba1d8a2e2282e17a859 /node_modules/form-data
parent843bdd6b1ac2c68cfbc78a75b62f3a7124a710ea (diff)
request@2.81.0
Downgraded to allow better deduplication
Diffstat (limited to 'node_modules/form-data')
-rw-r--r--node_modules/form-data/README.md29
-rw-r--r--node_modules/form-data/README.md.bak234
-rw-r--r--node_modules/form-data/lib/form_data.js43
-rw-r--r--node_modules/form-data/package.json24
4 files changed, 33 insertions, 297 deletions
diff --git a/node_modules/form-data/README.md b/node_modules/form-data/README.md
index cb421fbb4..78ef315ff 100644
--- a/node_modules/form-data/README.md
+++ b/node_modules/form-data/README.md
@@ -6,11 +6,11 @@ The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface]
[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface
-[![Linux Build](https://img.shields.io/travis/form-data/form-data/v2.3.2.svg?label=linux:4.x-9.x)](https://travis-ci.org/form-data/form-data)
-[![MacOS Build](https://img.shields.io/travis/form-data/form-data/v2.3.2.svg?label=macos:4.x-9.x)](https://travis-ci.org/form-data/form-data)
-[![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/form-data/v2.3.2.svg?label=windows:4.x-9.x)](https://ci.appveyor.com/project/alexindigo/form-data)
+[![Linux Build](https://img.shields.io/travis/form-data/form-data/v2.1.4.svg?label=linux:0.12-6.x)](https://travis-ci.org/form-data/form-data)
+[![MacOS Build](https://img.shields.io/travis/form-data/form-data/v2.1.4.svg?label=macos:0.12-6.x)](https://travis-ci.org/form-data/form-data)
+[![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/form-data/v2.1.4.svg?label=windows:0.12-6.x)](https://ci.appveyor.com/project/alexindigo/form-data)
-[![Coverage Status](https://img.shields.io/coveralls/form-data/form-data/v2.3.2.svg?label=code+coverage)](https://coveralls.io/github/form-data/form-data?branch=master)
+[![Coverage Status](https://img.shields.io/coveralls/form-data/form-data/v2.1.4.svg?label=code+coverage)](https://coveralls.io/github/form-data/form-data?branch=master)
[![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data)
[![bitHound Overall Score](https://www.bithound.io/github/form-data/form-data/badges/score.svg)](https://www.bithound.io/github/form-data/form-data)
@@ -75,20 +75,6 @@ form.submit('http://example.org/', function(err, res) {
For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods.
-### Custom options
-
-You can provide custom options, such as `maxDataSize`:
-
-``` javascript
-var FormData = require('form-data');
-
-var form = new FormData({ maxDataSize: 20971520 });
-form.append('my_field', 'my value');
-form.append('my_buffer', /* something big */);
-```
-
-List of available options could be found in [combined-stream](https://github.com/felixge/node-combined-stream/blob/master/lib/combined_stream.js#L7-L15)
-
### Alternative submission methods
You can use node's http client interface:
@@ -146,9 +132,8 @@ someModule.stream(function(err, stdout, stderr) {
var form = new FormData();
form.append('file', stdout, {
- filename: 'unicycle.jpg', // ... or:
- filepath: 'photos/toys/unicycle.jpg',
- contentType: 'image/jpeg',
+ filename: 'unicycle.jpg',
+ contentType: 'image/jpg',
knownLength: 19806
});
@@ -159,8 +144,6 @@ someModule.stream(function(err, stdout, stderr) {
});
```
-The `filepath` property overrides `filename` and may contain a relative path. This is typically used when uploading [multiple files from a directory](https://wicg.github.io/entries-api/#dom-htmlinputelement-webkitdirectory).
-
For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter:
``` javascript
diff --git a/node_modules/form-data/README.md.bak b/node_modules/form-data/README.md.bak
deleted file mode 100644
index 0524d6028..000000000
--- a/node_modules/form-data/README.md.bak
+++ /dev/null
@@ -1,234 +0,0 @@
-# Form-Data [![NPM Module](https://img.shields.io/npm/v/form-data.svg)](https://www.npmjs.com/package/form-data) [![Join the chat at https://gitter.im/form-data/form-data](http://form-data.github.io/images/gitterbadge.svg)](https://gitter.im/form-data/form-data)
-
-A library to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications.
-
-The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd].
-
-[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface
-
-[![Linux Build](https://img.shields.io/travis/form-data/form-data/master.svg?label=linux:4.x-9.x)](https://travis-ci.org/form-data/form-data)
-[![MacOS Build](https://img.shields.io/travis/form-data/form-data/master.svg?label=macos:4.x-9.x)](https://travis-ci.org/form-data/form-data)
-[![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/form-data/master.svg?label=windows:4.x-9.x)](https://ci.appveyor.com/project/alexindigo/form-data)
-
-[![Coverage Status](https://img.shields.io/coveralls/form-data/form-data/master.svg?label=code+coverage)](https://coveralls.io/github/form-data/form-data?branch=master)
-[![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data)
-[![bitHound Overall Score](https://www.bithound.io/github/form-data/form-data/badges/score.svg)](https://www.bithound.io/github/form-data/form-data)
-
-## Install
-
-```
-npm install --save form-data
-```
-
-## Usage
-
-In this example we are constructing a form with 3 fields that contain a string,
-a buffer and a file stream.
-
-``` javascript
-var FormData = require('form-data');
-var fs = require('fs');
-
-var form = new FormData();
-form.append('my_field', 'my value');
-form.append('my_buffer', new Buffer(10));
-form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
-```
-
-Also you can use http-response stream:
-
-``` javascript
-var FormData = require('form-data');
-var http = require('http');
-
-var form = new FormData();
-
-http.request('http://nodejs.org/images/logo.png', function(response) {
- form.append('my_field', 'my value');
- form.append('my_buffer', new Buffer(10));
- form.append('my_logo', response);
-});
-```
-
-Or @mikeal's [request](https://github.com/request/request) stream:
-
-``` javascript
-var FormData = require('form-data');
-var request = require('request');
-
-var form = new FormData();
-
-form.append('my_field', 'my value');
-form.append('my_buffer', new Buffer(10));
-form.append('my_logo', request('http://nodejs.org/images/logo.png'));
-```
-
-In order to submit this form to a web application, call ```submit(url, [callback])``` method:
-
-``` javascript
-form.submit('http://example.org/', function(err, res) {
- // res – response object (http.IncomingMessage) //
- res.resume();
-});
-
-```
-
-For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods.
-
-### Custom options
-
-You can provide custom options, such as `maxDataSize`:
-
-``` javascript
-var FormData = require('form-data');
-
-var form = new FormData({ maxDataSize: 20971520 });
-form.append('my_field', 'my value');
-form.append('my_buffer', /* something big */);
-```
-
-List of available options could be found in [combined-stream](https://github.com/felixge/node-combined-stream/blob/master/lib/combined_stream.js#L7-L15)
-
-### Alternative submission methods
-
-You can use node's http client interface:
-
-``` javascript
-var http = require('http');
-
-var request = http.request({
- method: 'post',
- host: 'example.org',
- path: '/upload',
- headers: form.getHeaders()
-});
-
-form.pipe(request);
-
-request.on('response', function(res) {
- console.log(res.statusCode);
-});
-```
-
-Or if you would prefer the `'Content-Length'` header to be set for you:
-
-``` javascript
-form.submit('example.org/upload', function(err, res) {
- console.log(res.statusCode);
-});
-```
-
-To use custom headers and pre-known length in parts:
-
-``` javascript
-var CRLF = '\r\n';
-var form = new FormData();
-
-var options = {
- header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF,
- knownLength: 1
-};
-
-form.append('my_buffer', buffer, options);
-
-form.submit('http://example.com/', function(err, res) {
- if (err) throw err;
- console.log('Done');
-});
-```
-
-Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually:
-
-``` javascript
-someModule.stream(function(err, stdout, stderr) {
- if (err) throw err;
-
- var form = new FormData();
-
- form.append('file', stdout, {
- filename: 'unicycle.jpg', // ... or:
- filepath: 'photos/toys/unicycle.jpg',
- contentType: 'image/jpeg',
- knownLength: 19806
- });
-
- form.submit('http://example.com/', function(err, res) {
- if (err) throw err;
- console.log('Done');
- });
-});
-```
-
-The `filepath` property overrides `filename` and may contain a relative path. This is typically used when uploading [multiple files from a directory](https://wicg.github.io/entries-api/#dom-htmlinputelement-webkitdirectory).
-
-For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter:
-
-``` javascript
-form.submit({
- host: 'example.com',
- path: '/probably.php?extra=params',
- auth: 'username:password'
-}, function(err, res) {
- console.log(res.statusCode);
-});
-```
-
-In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`:
-
-``` javascript
-form.submit({
- host: 'example.com',
- path: '/surelynot.php',
- headers: {'x-test-header': 'test-header-value'}
-}, function(err, res) {
- console.log(res.statusCode);
-});
-```
-
-### Integration with other libraries
-
-#### Request
-
-Form submission using [request](https://github.com/request/request):
-
-```javascript
-var formData = {
- my_field: 'my_value',
- my_file: fs.createReadStream(__dirname + '/unicycle.jpg'),
-};
-
-request.post({url:'http://service.com/upload', formData: formData}, function(err, httpResponse, body) {
- if (err) {
- return console.error('upload failed:', err);
- }
- console.log('Upload successful! Server responded with:', body);
-});
-```
-
-For more details see [request readme](https://github.com/request/request#multipartform-data-multipart-form-uploads).
-
-#### node-fetch
-
-You can also submit a form using [node-fetch](https://github.com/bitinn/node-fetch):
-
-```javascript
-var form = new FormData();
-
-form.append('a', 1);
-
-fetch('http://example.com', { method: 'POST', body: form })
- .then(function(res) {
- return res.json();
- }).then(function(json) {
- console.log(json);
- });
-```
-
-## Notes
-
-- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround.
-- Starting version `2.x` FormData has dropped support for `node@0.10.x`.
-
-## License
-
-Form-Data is released under the [MIT](License) license.
diff --git a/node_modules/form-data/lib/form_data.js b/node_modules/form-data/lib/form_data.js
index 3a1bb82b1..79aa0f9f5 100644
--- a/node_modules/form-data/lib/form_data.js
+++ b/node_modules/form-data/lib/form_data.js
@@ -21,9 +21,8 @@ util.inherits(FormData, CombinedStream);
* and file uploads to other web applications.
*
* @constructor
- * @param {Object} options - Properties to be added/overriden for FormData and CombinedStream
*/
-function FormData(options) {
+function FormData() {
if (!(this instanceof FormData)) {
return new FormData();
}
@@ -33,11 +32,6 @@ function FormData(options) {
this._valuesToMeasure = [];
CombinedStream.call(this);
-
- options = options || {};
- for (var option in options) {
- this[option] = options[option];
- }
}
FormData.LINE_BREAK = '\r\n';
@@ -192,7 +186,6 @@ FormData.prototype._multiPartHeader = function(field, value, options) {
var header;
for (var prop in headers) {
- if (!headers.hasOwnProperty(prop)) continue;
header = headers[prop];
// skip nullish headers.
@@ -216,25 +209,20 @@ FormData.prototype._multiPartHeader = function(field, value, options) {
FormData.prototype._getContentDisposition = function(value, options) {
- var filename
- , contentDisposition
- ;
+ var contentDisposition;
+
+ // custom filename takes precedence
+ // fs- and request- streams have path property
+ // formidable and the browser add a name property.
+ var filename = options.filename || value.name || value.path;
- if (typeof options.filepath === 'string') {
- // custom filepath for relative paths
- filename = path.normalize(options.filepath).replace(/\\/g, '/');
- } else if (options.filename || value.name || value.path) {
- // custom filename take precedence
- // formidable and the browser add a name property
- // fs- and request- streams have path property
- filename = path.basename(options.filename || value.name || value.path);
- } else if (value.readable && value.hasOwnProperty('httpVersion')) {
- // or try http response
- filename = path.basename(value.client._httpMessage.path);
+ // or try http response
+ if (!filename && value.readable && value.hasOwnProperty('httpVersion')) {
+ filename = value.client._httpMessage.path;
}
if (filename) {
- contentDisposition = 'filename="' + filename + '"';
+ contentDisposition = 'filename="' + path.basename(filename) + '"';
}
return contentDisposition;
@@ -260,9 +248,9 @@ FormData.prototype._getContentType = function(value, options) {
contentType = value.headers['content-type'];
}
- // or guess it from the filepath or filename
- if (!contentType && (options.filepath || options.filename)) {
- contentType = mime.lookup(options.filepath || options.filename);
+ // or guess it from the filename
+ if (!contentType && options.filename) {
+ contentType = mime.lookup(options.filename);
}
// fallback to the default content type if `value` is not simple value
@@ -400,8 +388,7 @@ FormData.prototype.submit = function(params, cb) {
options = populate({
port: params.port,
path: params.pathname,
- host: params.hostname,
- protocol: params.protocol
+ host: params.hostname
}, defaults);
// use custom params
diff --git a/node_modules/form-data/package.json b/node_modules/form-data/package.json
index f5ac03c1b..338703b99 100644
--- a/node_modules/form-data/package.json
+++ b/node_modules/form-data/package.json
@@ -1,27 +1,27 @@
{
- "_from": "form-data@~2.3.1",
- "_id": "form-data@2.3.2",
+ "_from": "form-data@~2.1.1",
+ "_id": "form-data@2.1.4",
"_inBundle": false,
- "_integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=",
+ "_integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=",
"_location": "/form-data",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
- "raw": "form-data@~2.3.1",
+ "raw": "form-data@~2.1.1",
"name": "form-data",
"escapedName": "form-data",
- "rawSpec": "~2.3.1",
+ "rawSpec": "~2.1.1",
"saveSpec": null,
- "fetchSpec": "~2.3.1"
+ "fetchSpec": "~2.1.1"
},
"_requiredBy": [
"/request"
],
- "_resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz",
- "_shasum": "4970498be604c20c005d4f5c23aecd21d6b49099",
- "_spec": "form-data@~2.3.1",
- "_where": "/Users/rebecca/code/npm/node_modules/request",
+ "_resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz",
+ "_shasum": "33c183acf193276ecaa98143a69e94bfee1750d1",
+ "_spec": "form-data@~2.1.1",
+ "_where": "/Users/zkat/Documents/code/work/npm/node_modules/request",
"author": {
"name": "Felix Geisendörfer",
"email": "felix@debuggable.com",
@@ -34,7 +34,7 @@
"bundleDependencies": false,
"dependencies": {
"asynckit": "^0.4.0",
- "combined-stream": "1.0.6",
+ "combined-stream": "^1.0.5",
"mime-types": "^2.1.12"
},
"deprecated": false,
@@ -94,5 +94,5 @@
"test": "istanbul cover test/run.js",
"update-readme": "sed -i.bak 's/\\/master\\.svg/\\/v'$(npm --silent run get-version)'.svg/g' README.md"
},
- "version": "2.3.2"
+ "version": "2.1.4"
}