fsevents 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fsevents might be problematic. Click here for more details.
- package/node_modules/ansi-styles/index.js +72 -6
- package/node_modules/ansi-styles/package.json +19 -12
- package/node_modules/ansi-styles/readme.md +36 -8
- package/node_modules/are-we-there-yet/CHANGES.md +19 -0
- package/node_modules/are-we-there-yet/README.md +12 -2
- package/node_modules/are-we-there-yet/index.js +4 -132
- package/node_modules/are-we-there-yet/package.json +18 -13
- package/node_modules/are-we-there-yet/test/lib/test-event.js +29 -0
- package/node_modules/are-we-there-yet/test/tracker.js +44 -43
- package/node_modules/are-we-there-yet/test/trackergroup.js +73 -64
- package/node_modules/are-we-there-yet/test/trackerstream.js +26 -40
- package/node_modules/are-we-there-yet/tracker-base.js +11 -0
- package/node_modules/are-we-there-yet/tracker-group.js +107 -0
- package/node_modules/are-we-there-yet/tracker-stream.js +35 -0
- package/node_modules/are-we-there-yet/tracker.js +30 -0
- package/node_modules/asn1/package.json +1 -2
- package/node_modules/assert-plus/package.json +1 -3
- package/node_modules/async/package.json +1 -1
- package/node_modules/aws4/.npmignore +2 -1
- package/node_modules/aws4/README.md +4 -0
- package/node_modules/aws4/aws4.js +8 -3
- package/node_modules/aws4/node_modules/lru-cache/.npmignore +3 -0
- package/node_modules/aws4/node_modules/lru-cache/.travis.yml +3 -4
- package/node_modules/aws4/node_modules/lru-cache/README.md +29 -24
- package/node_modules/aws4/node_modules/lru-cache/benchmarks/insertion-time.js +32 -0
- package/node_modules/aws4/node_modules/lru-cache/lib/lru-cache.js +333 -199
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/LICENSE +15 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/README.md +60 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/map.js +9 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/package.json +59 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/pseudomap.js +113 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/test/basic.js +86 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/.npmignore +4 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/.travis.yml +7 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/CONTRIBUTING.md +4 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/LICENSE +15 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/README.md +204 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/package.json +59 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/test/basic.js +188 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/yallist.js +360 -0
- package/node_modules/aws4/node_modules/lru-cache/package.json +16 -12
- package/node_modules/aws4/node_modules/lru-cache/test/basic.js +270 -146
- package/node_modules/aws4/node_modules/lru-cache/test/foreach.js +39 -25
- package/node_modules/aws4/node_modules/lru-cache/test/inspect.js +54 -0
- package/node_modules/aws4/node_modules/lru-cache/test/no-symbol.js +3 -0
- package/node_modules/aws4/node_modules/lru-cache/test/serialize.js +115 -104
- package/node_modules/aws4/package.json +17 -14
- package/node_modules/bl/bl.js +9 -3
- package/node_modules/bl/package.json +12 -12
- package/node_modules/bl/test/test.js +14 -0
- package/node_modules/color-convert/README.md +62 -0
- package/node_modules/color-convert/conversions.js +594 -0
- package/node_modules/color-convert/css-keywords.js +151 -0
- package/node_modules/color-convert/index.js +75 -0
- package/node_modules/color-convert/package.json +92 -0
- package/node_modules/color-convert/route.js +98 -0
- package/node_modules/dashdash/lib/dashdash.js +1 -1
- package/node_modules/dashdash/node_modules/assert-plus/AUTHORS +6 -0
- package/node_modules/dashdash/node_modules/assert-plus/CHANGES.md +14 -0
- package/node_modules/dashdash/node_modules/assert-plus/README.md +162 -0
- package/node_modules/dashdash/node_modules/assert-plus/assert.js +211 -0
- package/node_modules/dashdash/node_modules/assert-plus/package.json +89 -0
- package/node_modules/dashdash/package.json +19 -12
- package/node_modules/ecc-jsbn/package.json +1 -2
- package/node_modules/escape-string-regexp/package.json +15 -11
- package/node_modules/extsprintf/package.json +2 -3
- package/node_modules/form-data/.dockerignore +7 -0
- package/node_modules/form-data/.editorconfig +10 -0
- package/node_modules/form-data/.eslintignore +1 -0
- package/node_modules/form-data/.eslintrc +64 -0
- package/node_modules/form-data/{Readme.md → README.md} +9 -1
- package/node_modules/form-data/lib/browser.js +2 -1
- package/node_modules/form-data/lib/form_data.js +172 -135
- package/node_modules/form-data/lib/populate.js +9 -0
- package/node_modules/form-data/package.json +35 -16
- package/node_modules/form-data/wercker.yml +36 -0
- package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/index.js +1 -1
- package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/package.json +14 -10
- package/node_modules/gauge/README.md +1 -1
- package/node_modules/gauge/package.json +18 -14
- package/node_modules/gauge/progress-bar.js +2 -2
- package/node_modules/http-signature/package.json +1 -2
- package/node_modules/is-my-json-valid/README.md +2 -2
- package/node_modules/is-my-json-valid/index.js +15 -6
- package/node_modules/is-my-json-valid/package.json +11 -7
- package/node_modules/is-my-json-valid/test/json-schema-draft4/multipleOf.json +36 -0
- package/node_modules/is-my-json-valid/test/misc.js +18 -0
- package/node_modules/is-typedarray/package.json +1 -2
- package/node_modules/isarray/.npmignore +1 -0
- package/node_modules/isarray/.travis.yml +4 -0
- package/node_modules/isarray/Makefile +6 -0
- package/node_modules/isarray/README.md +6 -0
- package/node_modules/isarray/index.js +3 -1
- package/node_modules/isarray/package.json +28 -10
- package/node_modules/isarray/test.js +20 -0
- package/node_modules/jodid25519/package.json +1 -2
- package/node_modules/jsbn/package.json +1 -2
- package/node_modules/json-schema/package.json +1 -1
- package/node_modules/jsprim/package.json +1 -2
- package/node_modules/lodash.pad/LICENSE +17 -16
- package/node_modules/lodash.pad/README.md +2 -2
- package/node_modules/lodash.pad/index.js +3 -94
- package/node_modules/lodash.pad/package.json +12 -12
- package/node_modules/lodash.padend/LICENSE +23 -0
- package/node_modules/lodash.padend/README.md +18 -0
- package/node_modules/lodash.padend/index.js +285 -0
- package/node_modules/lodash.padend/package.json +91 -0
- package/node_modules/lodash.padstart/LICENSE +23 -0
- package/node_modules/lodash.padstart/README.md +18 -0
- package/node_modules/lodash.padstart/index.js +285 -0
- package/node_modules/lodash.padstart/package.json +91 -0
- package/node_modules/lodash.repeat/LICENSE +17 -16
- package/node_modules/lodash.repeat/README.md +2 -2
- package/node_modules/lodash.repeat/index.js +3 -94
- package/node_modules/lodash.repeat/package.json +14 -13
- package/node_modules/lodash.tostring/LICENSE +23 -0
- package/node_modules/lodash.tostring/README.md +18 -0
- package/node_modules/lodash.tostring/index.js +164 -0
- package/node_modules/lodash.tostring/package.json +91 -0
- package/node_modules/mime-db/HISTORY.md +14 -0
- package/node_modules/mime-db/db.json +26 -3
- package/node_modules/mime-db/package.json +23 -18
- package/node_modules/mime-types/HISTORY.md +8 -0
- package/node_modules/mime-types/README.md +1 -1
- package/node_modules/mime-types/package.json +21 -16
- package/node_modules/node-pre-gyp/CHANGELOG.md +11 -0
- package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +44 -4
- package/node_modules/node-pre-gyp/package.json +16 -16
- package/node_modules/npmlog/.nyc_output/64996.json +1 -0
- package/node_modules/npmlog/.nyc_output/64998.json +1 -0
- package/node_modules/npmlog/.nyc_output/65000.json +1 -0
- package/node_modules/npmlog/log.js +3 -2
- package/node_modules/npmlog/package.json +15 -11
- package/node_modules/npmlog/test/progress.js +25 -8
- package/node_modules/once/package.json +1 -1
- package/node_modules/qs/package.json +1 -2
- package/node_modules/readable-stream/.travis.yml +18 -16
- package/node_modules/readable-stream/README.md +1 -1
- package/node_modules/readable-stream/doc/stream.markdown +435 -405
- package/node_modules/readable-stream/lib/_stream_duplex.js +13 -20
- package/node_modules/readable-stream/lib/_stream_passthrough.js +3 -4
- package/node_modules/readable-stream/lib/_stream_readable.js +110 -205
- package/node_modules/readable-stream/lib/_stream_transform.js +21 -38
- package/node_modules/readable-stream/lib/_stream_writable.js +108 -121
- package/node_modules/readable-stream/package.json +19 -15
- package/node_modules/request/package.json +1 -2
- package/node_modules/rimraf/node_modules/glob/README.md +6 -0
- package/node_modules/rimraf/node_modules/glob/common.js +12 -3
- package/node_modules/rimraf/node_modules/glob/glob.js +20 -3
- package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +1 -1
- package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +14 -10
- package/node_modules/rimraf/node_modules/glob/package.json +15 -11
- package/node_modules/rimraf/node_modules/glob/sync.js +8 -1
- package/node_modules/rimraf/package.json +14 -10
- package/node_modules/semver/package.json +1 -2
- package/node_modules/sshpk/lib/formats/rfc4253.js +2 -1
- package/node_modules/sshpk/package.json +13 -10
- package/node_modules/strip-ansi/package.json +21 -16
- package/node_modules/strip-ansi/readme.md +5 -5
- package/node_modules/tough-cookie/lib/cookie.js +2 -2
- package/node_modules/tough-cookie/package.json +13 -9
- package/node_modules/tweetnacl/CHANGELOG.md +53 -0
- package/node_modules/tweetnacl/COPYING.txt +9 -0
- package/node_modules/tweetnacl/README.md +14 -40
- package/node_modules/tweetnacl/nacl-fast.js +21 -51
- package/node_modules/tweetnacl/nacl-fast.min.js +2 -2
- package/node_modules/tweetnacl/nacl.js +21 -51
- package/node_modules/tweetnacl/nacl.min.js +1 -1
- package/node_modules/tweetnacl/package.json +28 -38
- package/node_modules/verror/package.json +2 -3
- package/package.json +2 -2
- package/node_modules/aws4/example.js +0 -372
- package/node_modules/aws4/node_modules/lru-cache/test/memory-leak.js +0 -51
- package/node_modules/isarray/build/build.js +0 -209
- package/node_modules/lodash._basetostring/LICENSE +0 -22
- package/node_modules/lodash._basetostring/README.md +0 -20
- package/node_modules/lodash._basetostring/index.js +0 -22
- package/node_modules/lodash._basetostring/package.json +0 -99
- package/node_modules/lodash._createpadding/LICENSE +0 -22
- package/node_modules/lodash._createpadding/README.md +0 -20
- package/node_modules/lodash._createpadding/index.js +0 -37
- package/node_modules/lodash._createpadding/package.json +0 -101
- package/node_modules/lodash._root/LICENSE +0 -22
- package/node_modules/lodash._root/README.md +0 -18
- package/node_modules/lodash._root/index.js +0 -53
- package/node_modules/lodash._root/package.json +0 -77
- package/node_modules/lodash.padleft/LICENSE.txt +0 -22
- package/node_modules/lodash.padleft/README.md +0 -20
- package/node_modules/lodash.padleft/index.js +0 -50
- package/node_modules/lodash.padleft/package.json +0 -107
- package/node_modules/lodash.padright/LICENSE.txt +0 -22
- package/node_modules/lodash.padright/README.md +0 -20
- package/node_modules/lodash.padright/index.js +0 -50
- package/node_modules/lodash.padright/package.json +0 -107
@@ -7,29 +7,51 @@ var parseUrl = require('url').parse;
|
|
7
7
|
var fs = require('fs');
|
8
8
|
var mime = require('mime-types');
|
9
9
|
var async = require('async');
|
10
|
+
var populate = require('./populate.js');
|
10
11
|
|
12
|
+
// Public API
|
11
13
|
module.exports = FormData;
|
14
|
+
|
15
|
+
// make it a Stream
|
16
|
+
util.inherits(FormData, CombinedStream);
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Create readable "multipart/form-data" streams.
|
20
|
+
* Can be used to submit forms
|
21
|
+
* and file uploads to other web applications.
|
22
|
+
*
|
23
|
+
* @constructor
|
24
|
+
*/
|
12
25
|
function FormData() {
|
26
|
+
if (!(this instanceof FormData)) {
|
27
|
+
throw new TypeError('Failed to construct FormData: Please use the _new_ operator, this object constructor cannot be called as a function.');
|
28
|
+
}
|
29
|
+
|
13
30
|
this._overheadLength = 0;
|
14
31
|
this._valueLength = 0;
|
15
32
|
this._lengthRetrievers = [];
|
16
33
|
|
17
34
|
CombinedStream.call(this);
|
18
35
|
}
|
19
|
-
util.inherits(FormData, CombinedStream);
|
20
36
|
|
21
37
|
FormData.LINE_BREAK = '\r\n';
|
22
38
|
FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream';
|
23
39
|
|
24
40
|
FormData.prototype.append = function(field, value, options) {
|
25
|
-
|
26
|
-
|
27
|
-
|
41
|
+
|
42
|
+
options = options || {};
|
43
|
+
|
44
|
+
// allow filename as single option
|
45
|
+
if (typeof options == 'string') {
|
46
|
+
options = {filename: options};
|
47
|
+
}
|
28
48
|
|
29
49
|
var append = CombinedStream.prototype.append.bind(this);
|
30
50
|
|
31
51
|
// all that streamy business can't handle numbers
|
32
|
-
if (typeof value == 'number')
|
52
|
+
if (typeof value == 'number') {
|
53
|
+
value = '' + value;
|
54
|
+
}
|
33
55
|
|
34
56
|
// https://github.com/felixge/node-form-data/issues/38
|
35
57
|
if (util.isArray(value)) {
|
@@ -40,7 +62,7 @@ FormData.prototype.append = function(field, value, options) {
|
|
40
62
|
}
|
41
63
|
|
42
64
|
var header = this._multiPartHeader(field, value, options);
|
43
|
-
var footer = this._multiPartFooter(
|
65
|
+
var footer = this._multiPartFooter();
|
44
66
|
|
45
67
|
append(header);
|
46
68
|
append(value);
|
@@ -78,118 +100,141 @@ FormData.prototype._trackLength = function(header, value, options) {
|
|
78
100
|
}
|
79
101
|
|
80
102
|
// no need to bother with the length
|
81
|
-
if (!options.knownLength)
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
103
|
+
if (!options.knownLength) {
|
104
|
+
this._lengthRetrievers.push(function(next) {
|
105
|
+
|
106
|
+
if (value.hasOwnProperty('fd')) {
|
107
|
+
|
108
|
+
// take read range into a account
|
109
|
+
// `end` = Infinity –> read file till the end
|
110
|
+
//
|
111
|
+
// TODO: Looks like there is bug in Node fs.createReadStream
|
112
|
+
// it doesn't respect `end` options without `start` options
|
113
|
+
// Fix it when node fixes it.
|
114
|
+
// https://github.com/joyent/node/issues/7819
|
115
|
+
if (value.end != undefined && value.end != Infinity && value.start != undefined) {
|
116
|
+
|
117
|
+
// when end specified
|
118
|
+
// no need to calculate range
|
119
|
+
// inclusive, starts with 0
|
120
|
+
next(null, value.end + 1 - (value.start ? value.start : 0));
|
121
|
+
|
122
|
+
// not that fast snoopy
|
123
|
+
} else {
|
124
|
+
// still need to fetch file size from fs
|
125
|
+
fs.stat(value.path, function(err, stat) {
|
126
|
+
|
127
|
+
var fileSize;
|
128
|
+
|
129
|
+
if (err) {
|
130
|
+
next(err);
|
131
|
+
return;
|
132
|
+
}
|
133
|
+
|
134
|
+
// update final size based on the range options
|
135
|
+
fileSize = stat.size - (value.start ? value.start : 0);
|
136
|
+
next(null, fileSize);
|
137
|
+
});
|
138
|
+
}
|
139
|
+
|
140
|
+
// or http response
|
141
|
+
} else if (value.hasOwnProperty('httpVersion')) {
|
142
|
+
next(null, +value.headers['content-length']);
|
143
|
+
|
144
|
+
// or request stream http://github.com/mikeal/request
|
145
|
+
} else if (value.hasOwnProperty('httpModule')) {
|
146
|
+
// wait till response come back
|
147
|
+
value.on('response', function(response) {
|
148
|
+
value.pause();
|
149
|
+
next(null, +response.headers['content-length']);
|
115
150
|
});
|
116
|
-
|
151
|
+
value.resume();
|
117
152
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
// wait till response come back
|
125
|
-
value.on('response', function(response) {
|
126
|
-
value.pause();
|
127
|
-
next(null, +response.headers['content-length']);
|
128
|
-
});
|
129
|
-
value.resume();
|
130
|
-
|
131
|
-
// something else
|
132
|
-
} else {
|
133
|
-
next('Unknown stream');
|
134
|
-
}
|
135
|
-
});
|
153
|
+
// something else
|
154
|
+
} else {
|
155
|
+
next('Unknown stream');
|
156
|
+
}
|
157
|
+
});
|
158
|
+
}
|
136
159
|
};
|
137
160
|
|
138
161
|
FormData.prototype._multiPartHeader = function(field, value, options) {
|
139
162
|
// custom header specified (as string)?
|
140
163
|
// it becomes responsible for boundary
|
141
164
|
// (e.g. to handle extra CRLFs on .NET servers)
|
142
|
-
if (options.header
|
165
|
+
if (options.header) {
|
143
166
|
return options.header;
|
144
167
|
}
|
145
168
|
|
169
|
+
var contentDisposition = this._getContentDisposition(value, options);
|
170
|
+
var contentType = this._getContentType(value, options);
|
171
|
+
|
146
172
|
var contents = '';
|
147
173
|
var headers = {
|
148
|
-
|
149
|
-
'Content-
|
174
|
+
// add custom disposition as third element or keep it two elements if not
|
175
|
+
'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []),
|
176
|
+
// if no content type. allow it to be empty array
|
177
|
+
'Content-Type': [].concat(contentType || [])
|
150
178
|
};
|
151
179
|
|
152
|
-
// fs- and request- streams have path property
|
153
|
-
// or use custom filename and/or contentType
|
154
|
-
// TODO: Use request's response mime-type
|
155
|
-
if (options.filename || value.path) {
|
156
|
-
headers['Content-Disposition'].push(
|
157
|
-
'filename="' + path.basename(options.filename || value.path) + '"'
|
158
|
-
);
|
159
|
-
headers['Content-Type'].push(
|
160
|
-
options.contentType ||
|
161
|
-
mime.lookup(options.filename || value.path) ||
|
162
|
-
FormData.DEFAULT_CONTENT_TYPE
|
163
|
-
);
|
164
|
-
// http response has not
|
165
|
-
} else if (value.readable && value.hasOwnProperty('httpVersion')) {
|
166
|
-
headers['Content-Disposition'].push(
|
167
|
-
'filename="' + path.basename(value.client._httpMessage.path) + '"'
|
168
|
-
);
|
169
|
-
headers['Content-Type'].push(
|
170
|
-
options.contentType ||
|
171
|
-
value.headers['content-type'] ||
|
172
|
-
FormData.DEFAULT_CONTENT_TYPE
|
173
|
-
);
|
174
|
-
} else if (Buffer.isBuffer(value)) {
|
175
|
-
headers['Content-Type'].push(
|
176
|
-
options.contentType ||
|
177
|
-
FormData.DEFAULT_CONTENT_TYPE
|
178
|
-
);
|
179
|
-
} else if (options.contentType) {
|
180
|
-
headers['Content-Type'].push(options.contentType);
|
181
|
-
}
|
182
|
-
|
183
180
|
for (var prop in headers) {
|
184
181
|
if (headers[prop].length) {
|
185
182
|
contents += prop + ': ' + headers[prop].join('; ') + FormData.LINE_BREAK;
|
186
183
|
}
|
187
184
|
}
|
188
|
-
|
185
|
+
|
189
186
|
return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK;
|
190
187
|
};
|
191
188
|
|
192
|
-
FormData.prototype.
|
189
|
+
FormData.prototype._getContentDisposition = function(value, options) {
|
190
|
+
|
191
|
+
var contentDisposition;
|
192
|
+
|
193
|
+
// custom filename takes precedence
|
194
|
+
// fs- and request- streams have path property
|
195
|
+
var filename = options.filename || value.path;
|
196
|
+
|
197
|
+
// or try http response
|
198
|
+
if (!filename && value.readable && value.hasOwnProperty('httpVersion')) {
|
199
|
+
filename = value.client._httpMessage.path;
|
200
|
+
}
|
201
|
+
|
202
|
+
if (filename) {
|
203
|
+
contentDisposition = 'filename="' + path.basename(filename) + '"';
|
204
|
+
}
|
205
|
+
|
206
|
+
return contentDisposition;
|
207
|
+
};
|
208
|
+
|
209
|
+
FormData.prototype._getContentType = function(value, options) {
|
210
|
+
|
211
|
+
// use custom content-type above all
|
212
|
+
var contentType = options.contentType;
|
213
|
+
|
214
|
+
// or try `path` from fs-, request- streams
|
215
|
+
if (!contentType && value.path) {
|
216
|
+
contentType = mime.lookup(value.path);
|
217
|
+
}
|
218
|
+
|
219
|
+
// or if it's http-reponse
|
220
|
+
if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) {
|
221
|
+
contentType = value.headers['content-type'];
|
222
|
+
}
|
223
|
+
|
224
|
+
// or guess it from the filename
|
225
|
+
if (!contentType && options.filename) {
|
226
|
+
contentType = mime.lookup(options.filename);
|
227
|
+
}
|
228
|
+
|
229
|
+
// fallback to the default content type if `value` is not simple value
|
230
|
+
if (!contentType && typeof value == 'object') {
|
231
|
+
contentType = FormData.DEFAULT_CONTENT_TYPE;
|
232
|
+
}
|
233
|
+
|
234
|
+
return contentType;
|
235
|
+
};
|
236
|
+
|
237
|
+
FormData.prototype._multiPartFooter = function() {
|
193
238
|
return function(next) {
|
194
239
|
var footer = FormData.LINE_BREAK;
|
195
240
|
|
@@ -207,27 +252,30 @@ FormData.prototype._lastBoundary = function() {
|
|
207
252
|
};
|
208
253
|
|
209
254
|
FormData.prototype.getHeaders = function(userHeaders) {
|
255
|
+
var header;
|
210
256
|
var formHeaders = {
|
211
257
|
'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
|
212
258
|
};
|
213
259
|
|
214
|
-
for (
|
215
|
-
|
260
|
+
for (header in userHeaders) {
|
261
|
+
if (userHeaders.hasOwnProperty(header)) {
|
262
|
+
formHeaders[header.toLowerCase()] = userHeaders[header];
|
263
|
+
}
|
216
264
|
}
|
217
265
|
|
218
266
|
return formHeaders;
|
219
|
-
}
|
267
|
+
};
|
220
268
|
|
221
269
|
FormData.prototype.getCustomHeaders = function(contentType) {
|
222
|
-
|
270
|
+
contentType = contentType ? contentType : 'multipart/form-data';
|
223
271
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
272
|
+
var formHeaders = {
|
273
|
+
'content-type': contentType + '; boundary=' + this.getBoundary(),
|
274
|
+
'content-length': this.getLengthSync()
|
275
|
+
};
|
228
276
|
|
229
|
-
|
230
|
-
}
|
277
|
+
return formHeaders;
|
278
|
+
};
|
231
279
|
|
232
280
|
FormData.prototype.getBoundary = function() {
|
233
281
|
if (!this._boundary) {
|
@@ -251,7 +299,7 @@ FormData.prototype._generateBoundary = function() {
|
|
251
299
|
// Note: getLengthSync DOESN'T calculate streams length
|
252
300
|
// As workaround one can calculate file size manually
|
253
301
|
// and add it as knownLength option
|
254
|
-
FormData.prototype.getLengthSync = function(
|
302
|
+
FormData.prototype.getLengthSync = function() {
|
255
303
|
var knownLength = this._overheadLength + this._valueLength;
|
256
304
|
|
257
305
|
// Don't get confused, there are 3 "internal" streams for each keyval pair
|
@@ -260,9 +308,9 @@ FormData.prototype.getLengthSync = function(debug) {
|
|
260
308
|
knownLength += this._lastBoundary().length;
|
261
309
|
}
|
262
310
|
|
263
|
-
// https://github.com/
|
311
|
+
// https://github.com/form-data/form-data/issues/40
|
264
312
|
if (this._lengthRetrievers.length) {
|
265
|
-
// Some async length
|
313
|
+
// Some async length retrievers are present
|
266
314
|
// therefore synchronous length calculation is false.
|
267
315
|
// Please use getLength(callback) to get proper length
|
268
316
|
this._error(new Error('Cannot calculate proper length in synchronous way.'));
|
@@ -298,26 +346,25 @@ FormData.prototype.getLength = function(cb) {
|
|
298
346
|
};
|
299
347
|
|
300
348
|
FormData.prototype.submit = function(params, cb) {
|
301
|
-
|
302
349
|
var request
|
303
350
|
, options
|
304
|
-
, defaults = {
|
305
|
-
|
306
|
-
};
|
351
|
+
, defaults = {method: 'post'}
|
352
|
+
;
|
307
353
|
|
308
354
|
// parse provided url if it's string
|
309
355
|
// or treat it as options object
|
310
356
|
if (typeof params == 'string') {
|
311
|
-
params = parseUrl(params);
|
312
357
|
|
358
|
+
params = parseUrl(params);
|
313
359
|
options = populate({
|
314
360
|
port: params.port,
|
315
361
|
path: params.pathname,
|
316
362
|
host: params.hostname
|
317
363
|
}, defaults);
|
318
|
-
|
319
|
-
|
320
|
-
{
|
364
|
+
|
365
|
+
// use custom params
|
366
|
+
} else {
|
367
|
+
|
321
368
|
options = populate(params, defaults);
|
322
369
|
// if no port provided use default one
|
323
370
|
if (!options.port) {
|
@@ -337,8 +384,10 @@ FormData.prototype.submit = function(params, cb) {
|
|
337
384
|
|
338
385
|
// get content length and fire away
|
339
386
|
this.getLength(function(err, length) {
|
340
|
-
|
341
|
-
|
387
|
+
if (err) {
|
388
|
+
this._error(err);
|
389
|
+
return;
|
390
|
+
}
|
342
391
|
|
343
392
|
// add content length
|
344
393
|
request.setHeader('Content-Length', length);
|
@@ -354,21 +403,9 @@ FormData.prototype.submit = function(params, cb) {
|
|
354
403
|
};
|
355
404
|
|
356
405
|
FormData.prototype._error = function(err) {
|
357
|
-
if (this.error)
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
this.emit('error', err);
|
362
|
-
};
|
363
|
-
|
364
|
-
/*
|
365
|
-
* Santa's little helpers
|
366
|
-
*/
|
367
|
-
|
368
|
-
// populates missing values
|
369
|
-
function populate(dst, src) {
|
370
|
-
for (var prop in src) {
|
371
|
-
if (!dst[prop]) dst[prop] = src[prop];
|
406
|
+
if (!this.error) {
|
407
|
+
this.error = err;
|
408
|
+
this.pause();
|
409
|
+
this.emit('error', err);
|
372
410
|
}
|
373
|
-
|
374
|
-
}
|
411
|
+
};
|
@@ -1,19 +1,23 @@
|
|
1
1
|
{
|
2
2
|
"_from": "form-data@~1.0.0-rc3",
|
3
|
-
"_id": "form-data@1.0.0-
|
3
|
+
"_id": "form-data@1.0.0-rc4",
|
4
4
|
"_location": "/form-data",
|
5
|
-
"_nodeVersion": "
|
5
|
+
"_nodeVersion": "0.12.11",
|
6
|
+
"_npmOperationalInternal": {
|
7
|
+
"host": "packages-12-west.internal.npmjs.com",
|
8
|
+
"tmp": "tmp/form-data-1.0.0-rc4.tgz_1458059747097_0.14101114077493548"
|
9
|
+
},
|
6
10
|
"_npmUser": {
|
7
|
-
"email": "
|
8
|
-
"name": "
|
11
|
+
"email": "iam@alexindigo.com",
|
12
|
+
"name": "alexindigo"
|
9
13
|
},
|
10
|
-
"_npmVersion": "2.
|
14
|
+
"_npmVersion": "2.14.9",
|
11
15
|
"_phantomChildren": {},
|
12
16
|
"_requiredBy": [
|
13
17
|
"/request"
|
14
18
|
],
|
15
|
-
"_resolved": "https://registry.npmjs.org/form-data/-/form-data-1.0.0-
|
16
|
-
"_shasum": "
|
19
|
+
"_resolved": "https://registry.npmjs.org/form-data/-/form-data-1.0.0-rc4.tgz",
|
20
|
+
"_shasum": "05ac6bc22227b43e4461f488161554699d4f8b5e",
|
17
21
|
"_shrinkwrap": null,
|
18
22
|
"author": {
|
19
23
|
"email": "felix@debuggable.com",
|
@@ -25,27 +29,33 @@
|
|
25
29
|
"url": "https://github.com/form-data/form-data/issues"
|
26
30
|
},
|
27
31
|
"dependencies": {
|
28
|
-
"async": "^1.
|
32
|
+
"async": "^1.5.2",
|
29
33
|
"combined-stream": "^1.0.5",
|
30
|
-
"mime-types": "^2.1.
|
34
|
+
"mime-types": "^2.1.10"
|
31
35
|
},
|
32
36
|
"description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.",
|
33
37
|
"devDependencies": {
|
38
|
+
"codacy-coverage": "^1.1.3",
|
39
|
+
"coveralls": "^2.11.8",
|
40
|
+
"cross-spawn": "^2.1.5",
|
41
|
+
"eslint": "^2.4.0",
|
34
42
|
"fake": "^0.2.2",
|
35
43
|
"far": "^0.0.7",
|
36
44
|
"formidable": "^1.0.17",
|
37
|
-
"
|
38
|
-
"
|
45
|
+
"istanbul": "^0.4.2",
|
46
|
+
"pre-commit": "^1.1.2",
|
47
|
+
"request": "^2.69.0",
|
48
|
+
"rimraf": "^2.5.2"
|
39
49
|
},
|
40
50
|
"directories": {},
|
41
51
|
"dist": {
|
42
|
-
"shasum": "
|
43
|
-
"tarball": "http://registry.npmjs.org/form-data/-/form-data-1.0.0-
|
52
|
+
"shasum": "05ac6bc22227b43e4461f488161554699d4f8b5e",
|
53
|
+
"tarball": "http://registry.npmjs.org/form-data/-/form-data-1.0.0-rc4.tgz"
|
44
54
|
},
|
45
55
|
"engines": {
|
46
56
|
"node": ">= 0.10"
|
47
57
|
},
|
48
|
-
"gitHead": "
|
58
|
+
"gitHead": "f73996e0508ee2d4b2b376276adfac1de4188ac2",
|
49
59
|
"homepage": "https://github.com/form-data/form-data#readme",
|
50
60
|
"license": "MIT",
|
51
61
|
"main": "./lib/form_data",
|
@@ -78,6 +88,8 @@
|
|
78
88
|
"name": "form-data",
|
79
89
|
"optionalDependencies": {},
|
80
90
|
"pre-commit": [
|
91
|
+
"check",
|
92
|
+
"lint",
|
81
93
|
"test"
|
82
94
|
],
|
83
95
|
"readme": "ERROR: No README data found!",
|
@@ -86,7 +98,14 @@
|
|
86
98
|
"url": "git://github.com/form-data/form-data.git"
|
87
99
|
},
|
88
100
|
"scripts": {
|
89
|
-
"
|
101
|
+
"check": "istanbul check-coverage coverage/coverage*.json",
|
102
|
+
"coverage": "codacy-coverage < ./coverage/lcov.info; true",
|
103
|
+
"debug": "verbose=1 ./test/run.js",
|
104
|
+
"lint": "eslint lib/*.js test/*.js test/**/*.js",
|
105
|
+
"posttest": "istanbul report",
|
106
|
+
"predebug": "rimraf coverage test/tmp",
|
107
|
+
"pretest": "rimraf coverage test/tmp",
|
108
|
+
"test": "istanbul cover --report none test/run.js"
|
90
109
|
},
|
91
|
-
"version": "1.0.0-
|
110
|
+
"version": "1.0.0-rc4"
|
92
111
|
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# This references the default nodejs container from
|
2
|
+
# the Docker Hub: https://registry.hub.docker.com/_/node/
|
3
|
+
# If you want Nodesource's container you would reference nodesource/node
|
4
|
+
# Read more about containers on our dev center
|
5
|
+
# http://devcenter.wercker.com/docs/containers/index.html
|
6
|
+
box: node
|
7
|
+
# This is the build pipeline. Pipelines are the core of wercker
|
8
|
+
# Read more about pipelines on our dev center
|
9
|
+
# http://devcenter.wercker.com/docs/pipelines/index.html
|
10
|
+
|
11
|
+
# You can also use services such as databases. Read more on our dev center:
|
12
|
+
# http://devcenter.wercker.com/docs/services/index.html
|
13
|
+
# services:
|
14
|
+
# - postgres
|
15
|
+
# http://devcenter.wercker.com/docs/services/postgresql.html
|
16
|
+
|
17
|
+
# - mongodb
|
18
|
+
# http://devcenter.wercker.com/docs/services/mongodb.html
|
19
|
+
build:
|
20
|
+
# The steps that will be executed on build
|
21
|
+
# Steps make up the actions in your pipeline
|
22
|
+
# Read more about steps on our dev center:
|
23
|
+
# http://devcenter.wercker.com/docs/steps/index.html
|
24
|
+
steps:
|
25
|
+
# A step that executes `npm install` command
|
26
|
+
- npm-install
|
27
|
+
# A step that executes `npm test` command
|
28
|
+
- npm-test
|
29
|
+
|
30
|
+
# A custom script step, name value is used in the UI
|
31
|
+
# and the code value contains the command that get executed
|
32
|
+
- script:
|
33
|
+
name: echo nodejs information
|
34
|
+
code: |
|
35
|
+
echo "node version $(node -v) running"
|
36
|
+
echo "npm version $(npm -v) running"
|
package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/index.js
CHANGED
@@ -99,7 +99,7 @@ function expand(str, isTop) {
|
|
99
99
|
var isOptions = /^(.*,)+(.+)?$/.test(m.body);
|
100
100
|
if (!isSequence && !isOptions) {
|
101
101
|
// {a},b}
|
102
|
-
if (m.post.match(
|
102
|
+
if (m.post.match(/,.*\}/)) {
|
103
103
|
str = m.pre + '{' + m.body + escClose + m.post;
|
104
104
|
return expand(str);
|
105
105
|
}
|
package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/package.json
CHANGED
@@ -1,19 +1,23 @@
|
|
1
1
|
{
|
2
2
|
"_from": "brace-expansion@^1.0.0",
|
3
|
-
"_id": "brace-expansion@1.1.
|
3
|
+
"_id": "brace-expansion@1.1.3",
|
4
4
|
"_location": "/fstream-ignore/minimatch/brace-expansion",
|
5
|
-
"_nodeVersion": "
|
5
|
+
"_nodeVersion": "5.5.0",
|
6
|
+
"_npmOperationalInternal": {
|
7
|
+
"host": "packages-6-west.internal.npmjs.com",
|
8
|
+
"tmp": "tmp/brace-expansion-1.1.3.tgz_1455216688668_0.948847763473168"
|
9
|
+
},
|
6
10
|
"_npmUser": {
|
7
11
|
"email": "julian@juliangruber.com",
|
8
12
|
"name": "juliangruber"
|
9
13
|
},
|
10
|
-
"_npmVersion": "
|
14
|
+
"_npmVersion": "3.3.12",
|
11
15
|
"_phantomChildren": {},
|
12
16
|
"_requiredBy": [
|
13
17
|
"/fstream-ignore/minimatch"
|
14
18
|
],
|
15
|
-
"_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.
|
16
|
-
"_shasum": "
|
19
|
+
"_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.3.tgz",
|
20
|
+
"_shasum": "46bff50115d47fc9ab89854abb87d98078a10991",
|
17
21
|
"_shrinkwrap": null,
|
18
22
|
"author": {
|
19
23
|
"email": "mail@juliangruber.com",
|
@@ -29,14 +33,14 @@
|
|
29
33
|
},
|
30
34
|
"description": "Brace expansion as known from sh/bash",
|
31
35
|
"devDependencies": {
|
32
|
-
"tape": "4.
|
36
|
+
"tape": "4.4.0"
|
33
37
|
},
|
34
38
|
"directories": {},
|
35
39
|
"dist": {
|
36
|
-
"shasum": "
|
37
|
-
"tarball": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.
|
40
|
+
"shasum": "46bff50115d47fc9ab89854abb87d98078a10991",
|
41
|
+
"tarball": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.3.tgz"
|
38
42
|
},
|
39
|
-
"gitHead": "
|
43
|
+
"gitHead": "f0da1bb668e655f67b6b2d660c6e1c19e2a6f231",
|
40
44
|
"homepage": "https://github.com/juliangruber/brace-expansion",
|
41
45
|
"keywords": [],
|
42
46
|
"license": "MIT",
|
@@ -78,5 +82,5 @@
|
|
78
82
|
],
|
79
83
|
"files": "test/*.js"
|
80
84
|
},
|
81
|
-
"version": "1.1.
|
85
|
+
"version": "1.1.3"
|
82
86
|
}
|