node-red-contrib-web-worldmap 2.24.0 → 2.24.1

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/README.md +2 -1
  3. package/node_modules/{bytes → body-parser/node_modules/bytes}/History.md +0 -5
  4. package/node_modules/{bytes → body-parser/node_modules/bytes}/LICENSE +0 -0
  5. package/node_modules/{bytes → body-parser/node_modules/bytes}/Readme.md +16 -42
  6. package/node_modules/{bytes → body-parser/node_modules/bytes}/index.js +1 -5
  7. package/node_modules/{bytes → body-parser/node_modules/bytes}/package.json +22 -21
  8. package/node_modules/body-parser/package.json +2 -2
  9. package/node_modules/content-disposition/node_modules/safe-buffer/package.json +2 -2
  10. package/node_modules/content-disposition/package.json +2 -2
  11. package/node_modules/cookie/package.json +2 -2
  12. package/node_modules/express/node_modules/safe-buffer/package.json +2 -2
  13. package/node_modules/express/package.json +8 -9
  14. package/node_modules/faye-websocket/package.json +2 -2
  15. package/node_modules/forwarded/package.json +2 -2
  16. package/node_modules/http-errors/package.json +4 -4
  17. package/node_modules/inherits/package.json +2 -2
  18. package/node_modules/ipaddr.js/package.json +2 -2
  19. package/node_modules/proxy-addr/package.json +2 -2
  20. package/node_modules/qs/package.json +3 -3
  21. package/node_modules/raw-body/node_modules/bytes/History.md +87 -0
  22. package/node_modules/raw-body/node_modules/bytes/LICENSE +23 -0
  23. package/node_modules/raw-body/node_modules/bytes/Readme.md +126 -0
  24. package/node_modules/raw-body/node_modules/bytes/index.js +162 -0
  25. package/node_modules/raw-body/node_modules/bytes/package.json +86 -0
  26. package/node_modules/raw-body/package.json +2 -2
  27. package/node_modules/send/node_modules/ms/package.json +2 -2
  28. package/node_modules/send/package.json +3 -3
  29. package/node_modules/serve-static/package.json +2 -2
  30. package/node_modules/setprototypeof/package.json +3 -3
  31. package/node_modules/sockjs/package.json +8 -9
  32. package/node_modules/toidentifier/package.json +2 -2
  33. package/node_modules/uuid/package.json +2 -2
  34. package/node_modules/websocket-driver/node_modules/http-parser-js/CHANGELOG.md +14 -0
  35. package/node_modules/{http-parser-js → websocket-driver/node_modules/http-parser-js}/LICENSE.md +0 -0
  36. package/node_modules/websocket-driver/node_modules/http-parser-js/README.md +31 -0
  37. package/node_modules/{http-parser-js → websocket-driver/node_modules/http-parser-js}/http-parser.js +5 -8
  38. package/node_modules/{http-parser-js → websocket-driver/node_modules/http-parser-js}/package.json +20 -18
  39. package/package.json +1 -1
  40. package/worldmap/worldmap.js +3 -2
  41. package/node_modules/http-parser-js/README.md +0 -39
  42. package/node_modules/http-parser-js/http-parser.d.ts +0 -175
@@ -0,0 +1,126 @@
1
+ # Bytes utility
2
+
3
+ [![NPM Version][npm-image]][npm-url]
4
+ [![NPM Downloads][downloads-image]][downloads-url]
5
+ [![Build Status][travis-image]][travis-url]
6
+ [![Test Coverage][coveralls-image]][coveralls-url]
7
+
8
+ Utility to parse a string bytes (ex: `1TB`) to bytes (`1099511627776`) and vice-versa.
9
+
10
+ ## Installation
11
+
12
+ This is a [Node.js](https://nodejs.org/en/) module available through the
13
+ [npm registry](https://www.npmjs.com/). Installation is done using the
14
+ [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
15
+
16
+ ```bash
17
+ $ npm install bytes
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```js
23
+ var bytes = require('bytes');
24
+ ```
25
+
26
+ #### bytes.format(number value, [options]): string|null
27
+
28
+ Format the given value in bytes into a string. If the value is negative, it is kept as such. If it is a float, it is
29
+ rounded.
30
+
31
+ **Arguments**
32
+
33
+ | Name | Type | Description |
34
+ |---------|----------|--------------------|
35
+ | value | `number` | Value in bytes |
36
+ | options | `Object` | Conversion options |
37
+
38
+ **Options**
39
+
40
+ | Property | Type | Description |
41
+ |-------------------|--------|-----------------------------------------------------------------------------------------|
42
+ | decimalPlaces | `number`|`null` | Maximum number of decimal places to include in output. Default value to `2`. |
43
+ | fixedDecimals | `boolean`|`null` | Whether to always display the maximum number of decimal places. Default value to `false` |
44
+ | thousandsSeparator | `string`|`null` | Example of values: `' '`, `','` and `.`... Default value to `''`. |
45
+ | unit | `string`|`null` | The unit in which the result will be returned (B/KB/MB/GB/TB). Default value to `''` (which means auto detect). |
46
+ | unitSeparator | `string`|`null` | Separator to use between number and unit. Default value to `''`. |
47
+
48
+ **Returns**
49
+
50
+ | Name | Type | Description |
51
+ |---------|------------------|-------------------------------------------------|
52
+ | results | `string`|`null` | Return null upon error. String value otherwise. |
53
+
54
+ **Example**
55
+
56
+ ```js
57
+ bytes(1024);
58
+ // output: '1KB'
59
+
60
+ bytes(1000);
61
+ // output: '1000B'
62
+
63
+ bytes(1000, {thousandsSeparator: ' '});
64
+ // output: '1 000B'
65
+
66
+ bytes(1024 * 1.7, {decimalPlaces: 0});
67
+ // output: '2KB'
68
+
69
+ bytes(1024, {unitSeparator: ' '});
70
+ // output: '1 KB'
71
+
72
+ ```
73
+
74
+ #### bytes.parse(string|number value): number|null
75
+
76
+ Parse the string value into an integer in bytes. If no unit is given, or `value`
77
+ is a number, it is assumed the value is in bytes.
78
+
79
+ Supported units and abbreviations are as follows and are case-insensitive:
80
+
81
+ * `b` for bytes
82
+ * `kb` for kilobytes
83
+ * `mb` for megabytes
84
+ * `gb` for gigabytes
85
+ * `tb` for terabytes
86
+ * `pb` for petabytes
87
+
88
+ The units are in powers of two, not ten. This means 1kb = 1024b according to this parser.
89
+
90
+ **Arguments**
91
+
92
+ | Name | Type | Description |
93
+ |---------------|--------|--------------------|
94
+ | value | `string`|`number` | String to parse, or number in bytes. |
95
+
96
+ **Returns**
97
+
98
+ | Name | Type | Description |
99
+ |---------|-------------|-------------------------|
100
+ | results | `number`|`null` | Return null upon error. Value in bytes otherwise. |
101
+
102
+ **Example**
103
+
104
+ ```js
105
+ bytes('1KB');
106
+ // output: 1024
107
+
108
+ bytes('1024');
109
+ // output: 1024
110
+
111
+ bytes(1024);
112
+ // output: 1KB
113
+ ```
114
+
115
+ ## License
116
+
117
+ [MIT](LICENSE)
118
+
119
+ [coveralls-image]: https://badgen.net/coveralls/c/github/visionmedia/bytes.js/master
120
+ [coveralls-url]: https://coveralls.io/r/visionmedia/bytes.js?branch=master
121
+ [downloads-image]: https://badgen.net/npm/dm/bytes
122
+ [downloads-url]: https://npmjs.org/package/bytes
123
+ [npm-image]: https://badgen.net/npm/node/bytes
124
+ [npm-url]: https://npmjs.org/package/bytes
125
+ [travis-image]: https://badgen.net/travis/visionmedia/bytes.js/master
126
+ [travis-url]: https://travis-ci.org/visionmedia/bytes.js
@@ -0,0 +1,162 @@
1
+ /*!
2
+ * bytes
3
+ * Copyright(c) 2012-2014 TJ Holowaychuk
4
+ * Copyright(c) 2015 Jed Watson
5
+ * MIT Licensed
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ /**
11
+ * Module exports.
12
+ * @public
13
+ */
14
+
15
+ module.exports = bytes;
16
+ module.exports.format = format;
17
+ module.exports.parse = parse;
18
+
19
+ /**
20
+ * Module variables.
21
+ * @private
22
+ */
23
+
24
+ var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
25
+
26
+ var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
27
+
28
+ var map = {
29
+ b: 1,
30
+ kb: 1 << 10,
31
+ mb: 1 << 20,
32
+ gb: 1 << 30,
33
+ tb: Math.pow(1024, 4),
34
+ pb: Math.pow(1024, 5),
35
+ };
36
+
37
+ var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
38
+
39
+ /**
40
+ * Convert the given value in bytes into a string or parse to string to an integer in bytes.
41
+ *
42
+ * @param {string|number} value
43
+ * @param {{
44
+ * case: [string],
45
+ * decimalPlaces: [number]
46
+ * fixedDecimals: [boolean]
47
+ * thousandsSeparator: [string]
48
+ * unitSeparator: [string]
49
+ * }} [options] bytes options.
50
+ *
51
+ * @returns {string|number|null}
52
+ */
53
+
54
+ function bytes(value, options) {
55
+ if (typeof value === 'string') {
56
+ return parse(value);
57
+ }
58
+
59
+ if (typeof value === 'number') {
60
+ return format(value, options);
61
+ }
62
+
63
+ return null;
64
+ }
65
+
66
+ /**
67
+ * Format the given value in bytes into a string.
68
+ *
69
+ * If the value is negative, it is kept as such. If it is a float,
70
+ * it is rounded.
71
+ *
72
+ * @param {number} value
73
+ * @param {object} [options]
74
+ * @param {number} [options.decimalPlaces=2]
75
+ * @param {number} [options.fixedDecimals=false]
76
+ * @param {string} [options.thousandsSeparator=]
77
+ * @param {string} [options.unit=]
78
+ * @param {string} [options.unitSeparator=]
79
+ *
80
+ * @returns {string|null}
81
+ * @public
82
+ */
83
+
84
+ function format(value, options) {
85
+ if (!Number.isFinite(value)) {
86
+ return null;
87
+ }
88
+
89
+ var mag = Math.abs(value);
90
+ var thousandsSeparator = (options && options.thousandsSeparator) || '';
91
+ var unitSeparator = (options && options.unitSeparator) || '';
92
+ var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2;
93
+ var fixedDecimals = Boolean(options && options.fixedDecimals);
94
+ var unit = (options && options.unit) || '';
95
+
96
+ if (!unit || !map[unit.toLowerCase()]) {
97
+ if (mag >= map.pb) {
98
+ unit = 'PB';
99
+ } else if (mag >= map.tb) {
100
+ unit = 'TB';
101
+ } else if (mag >= map.gb) {
102
+ unit = 'GB';
103
+ } else if (mag >= map.mb) {
104
+ unit = 'MB';
105
+ } else if (mag >= map.kb) {
106
+ unit = 'KB';
107
+ } else {
108
+ unit = 'B';
109
+ }
110
+ }
111
+
112
+ var val = value / map[unit.toLowerCase()];
113
+ var str = val.toFixed(decimalPlaces);
114
+
115
+ if (!fixedDecimals) {
116
+ str = str.replace(formatDecimalsRegExp, '$1');
117
+ }
118
+
119
+ if (thousandsSeparator) {
120
+ str = str.replace(formatThousandsRegExp, thousandsSeparator);
121
+ }
122
+
123
+ return str + unitSeparator + unit;
124
+ }
125
+
126
+ /**
127
+ * Parse the string value into an integer in bytes.
128
+ *
129
+ * If no unit is given, it is assumed the value is in bytes.
130
+ *
131
+ * @param {number|string} val
132
+ *
133
+ * @returns {number|null}
134
+ * @public
135
+ */
136
+
137
+ function parse(val) {
138
+ if (typeof val === 'number' && !isNaN(val)) {
139
+ return val;
140
+ }
141
+
142
+ if (typeof val !== 'string') {
143
+ return null;
144
+ }
145
+
146
+ // Test if the string passed is valid
147
+ var results = parseRegExp.exec(val);
148
+ var floatValue;
149
+ var unit = 'b';
150
+
151
+ if (!results) {
152
+ // Nothing could be extracted from the given string
153
+ floatValue = parseInt(val, 10);
154
+ unit = 'b'
155
+ } else {
156
+ // Retrieve the value and the unit
157
+ floatValue = parseFloat(results[1]);
158
+ unit = results[4].toLowerCase();
159
+ }
160
+
161
+ return Math.floor(map[unit] * floatValue);
162
+ }
@@ -0,0 +1,86 @@
1
+ {
2
+ "_args": [
3
+ [
4
+ "bytes@3.1.0",
5
+ "/Users/conway/.node-red"
6
+ ]
7
+ ],
8
+ "_from": "bytes@3.1.0",
9
+ "_id": "bytes@3.1.0",
10
+ "_inBundle": false,
11
+ "_integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==",
12
+ "_location": "/node-red-contrib-web-worldmap/raw-body/bytes",
13
+ "_phantomChildren": {},
14
+ "_requested": {
15
+ "type": "version",
16
+ "registry": true,
17
+ "raw": "bytes@3.1.0",
18
+ "name": "bytes",
19
+ "escapedName": "bytes",
20
+ "rawSpec": "3.1.0",
21
+ "saveSpec": null,
22
+ "fetchSpec": "3.1.0"
23
+ },
24
+ "_requiredBy": [
25
+ "/node-red-contrib-web-worldmap/raw-body"
26
+ ],
27
+ "_resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
28
+ "_spec": "3.1.0",
29
+ "_where": "/Users/conway/.node-red",
30
+ "author": {
31
+ "name": "TJ Holowaychuk",
32
+ "email": "tj@vision-media.ca",
33
+ "url": "http://tjholowaychuk.com"
34
+ },
35
+ "bugs": {
36
+ "url": "https://github.com/visionmedia/bytes.js/issues"
37
+ },
38
+ "contributors": [
39
+ {
40
+ "name": "Jed Watson",
41
+ "email": "jed.watson@me.com"
42
+ },
43
+ {
44
+ "name": "Théo FIDRY",
45
+ "email": "theo.fidry@gmail.com"
46
+ }
47
+ ],
48
+ "description": "Utility to parse a string bytes to bytes and vice-versa",
49
+ "devDependencies": {
50
+ "eslint": "5.12.1",
51
+ "mocha": "5.2.0",
52
+ "nyc": "13.1.0"
53
+ },
54
+ "engines": {
55
+ "node": ">= 0.8"
56
+ },
57
+ "files": [
58
+ "History.md",
59
+ "LICENSE",
60
+ "Readme.md",
61
+ "index.js"
62
+ ],
63
+ "homepage": "https://github.com/visionmedia/bytes.js#readme",
64
+ "keywords": [
65
+ "byte",
66
+ "bytes",
67
+ "utility",
68
+ "parse",
69
+ "parser",
70
+ "convert",
71
+ "converter"
72
+ ],
73
+ "license": "MIT",
74
+ "name": "bytes",
75
+ "repository": {
76
+ "type": "git",
77
+ "url": "git+https://github.com/visionmedia/bytes.js.git"
78
+ },
79
+ "scripts": {
80
+ "lint": "eslint .",
81
+ "test": "mocha --check-leaks --reporter spec",
82
+ "test-ci": "nyc --reporter=text npm test",
83
+ "test-cov": "nyc --reporter=html --reporter=text npm test"
84
+ },
85
+ "version": "3.1.0"
86
+ }
@@ -3,7 +3,7 @@
3
3
  "_id": "raw-body@2.4.2",
4
4
  "_inBundle": false,
5
5
  "_integrity": "sha512-RPMAFUJP19WIet/99ngh6Iv8fzAbqum4Li7AD6DtGaW2RpMB/11xDoalPiJMTbu6I3hkbMVkATvZrqb9EEqeeQ==",
6
- "_location": "/raw-body",
6
+ "_location": "/node-red-contrib-web-worldmap/raw-body",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
9
9
  "type": "version",
@@ -16,7 +16,7 @@
16
16
  "fetchSpec": "2.4.2"
17
17
  },
18
18
  "_requiredBy": [
19
- "/body-parser"
19
+ "/node-red-contrib-web-worldmap/body-parser"
20
20
  ],
21
21
  "_resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.2.tgz",
22
22
  "_shasum": "baf3e9c21eebced59dd6533ac872b71f7b61cb32",
@@ -3,7 +3,7 @@
3
3
  "_id": "ms@2.1.3",
4
4
  "_inBundle": false,
5
5
  "_integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
6
- "_location": "/send/ms",
6
+ "_location": "/node-red-contrib-web-worldmap/send/ms",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
9
9
  "type": "version",
@@ -16,7 +16,7 @@
16
16
  "fetchSpec": "2.1.3"
17
17
  },
18
18
  "_requiredBy": [
19
- "/send"
19
+ "/node-red-contrib-web-worldmap/send"
20
20
  ],
21
21
  "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
22
22
  "_shasum": "574c8138ce1d2b5861f0b44579dbadd60c6615b2",
@@ -3,7 +3,7 @@
3
3
  "_id": "send@0.17.2",
4
4
  "_inBundle": false,
5
5
  "_integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==",
6
- "_location": "/send",
6
+ "_location": "/node-red-contrib-web-worldmap/send",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
9
9
  "type": "version",
@@ -16,8 +16,8 @@
16
16
  "fetchSpec": "0.17.2"
17
17
  },
18
18
  "_requiredBy": [
19
- "/express",
20
- "/serve-static"
19
+ "/node-red-contrib-web-worldmap/express",
20
+ "/node-red-contrib-web-worldmap/serve-static"
21
21
  ],
22
22
  "_resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz",
23
23
  "_shasum": "926622f76601c41808012c8bf1688fe3906f7820",
@@ -3,7 +3,7 @@
3
3
  "_id": "serve-static@1.14.2",
4
4
  "_inBundle": false,
5
5
  "_integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==",
6
- "_location": "/serve-static",
6
+ "_location": "/node-red-contrib-web-worldmap/serve-static",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
9
9
  "type": "version",
@@ -16,7 +16,7 @@
16
16
  "fetchSpec": "1.14.2"
17
17
  },
18
18
  "_requiredBy": [
19
- "/express"
19
+ "/node-red-contrib-web-worldmap/express"
20
20
  ],
21
21
  "_resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz",
22
22
  "_shasum": "722d6294b1d62626d41b43a013ece4598d292bfa",
@@ -3,7 +3,7 @@
3
3
  "_id": "setprototypeof@1.2.0",
4
4
  "_inBundle": false,
5
5
  "_integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
6
- "_location": "/setprototypeof",
6
+ "_location": "/node-red-contrib-web-worldmap/setprototypeof",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
9
9
  "type": "version",
@@ -16,8 +16,8 @@
16
16
  "fetchSpec": "1.2.0"
17
17
  },
18
18
  "_requiredBy": [
19
- "/express",
20
- "/http-errors"
19
+ "/node-red-contrib-web-worldmap/express",
20
+ "/node-red-contrib-web-worldmap/http-errors"
21
21
  ],
22
22
  "_resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
23
23
  "_shasum": "66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424",
@@ -1,27 +1,26 @@
1
1
  {
2
- "_from": "sockjs@0.3.24",
2
+ "_from": "sockjs@~0.3.24",
3
3
  "_id": "sockjs@0.3.24",
4
4
  "_inBundle": false,
5
5
  "_integrity": "sha512-GJgLTZ7vYb/JtPSSZ10hsOYIvEYsjbNU+zPdIHcUaWVNUEPivzxku31865sSSud0Da0W4lEeOPlmw93zLQchuQ==",
6
- "_location": "/sockjs",
6
+ "_location": "/node-red-contrib-web-worldmap/sockjs",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
9
- "type": "version",
9
+ "type": "range",
10
10
  "registry": true,
11
- "raw": "sockjs@0.3.24",
11
+ "raw": "sockjs@~0.3.24",
12
12
  "name": "sockjs",
13
13
  "escapedName": "sockjs",
14
- "rawSpec": "0.3.24",
14
+ "rawSpec": "~0.3.24",
15
15
  "saveSpec": null,
16
- "fetchSpec": "0.3.24"
16
+ "fetchSpec": "~0.3.24"
17
17
  },
18
18
  "_requiredBy": [
19
- "#USER",
20
- "/"
19
+ "/node-red-contrib-web-worldmap"
21
20
  ],
22
21
  "_resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.24.tgz",
23
22
  "_shasum": "c9bc8995f33a111bea0395ec30aa3206bdb5ccce",
24
- "_spec": "sockjs@0.3.24",
23
+ "_spec": "sockjs@~0.3.24",
25
24
  "_where": "/Users/conway/Projects/worldmap",
26
25
  "author": {
27
26
  "name": "Marek Majkowski"
@@ -3,7 +3,7 @@
3
3
  "_id": "toidentifier@1.0.1",
4
4
  "_inBundle": false,
5
5
  "_integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
6
- "_location": "/toidentifier",
6
+ "_location": "/node-red-contrib-web-worldmap/toidentifier",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
9
9
  "type": "version",
@@ -16,7 +16,7 @@
16
16
  "fetchSpec": "1.0.1"
17
17
  },
18
18
  "_requiredBy": [
19
- "/http-errors"
19
+ "/node-red-contrib-web-worldmap/http-errors"
20
20
  ],
21
21
  "_resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
22
22
  "_shasum": "3be34321a88a820ed1bd80dfaa33e479fbb8dd35",
@@ -3,7 +3,7 @@
3
3
  "_id": "uuid@8.3.2",
4
4
  "_inBundle": false,
5
5
  "_integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
6
- "_location": "/uuid",
6
+ "_location": "/node-red-contrib-web-worldmap/uuid",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
9
9
  "type": "range",
@@ -16,7 +16,7 @@
16
16
  "fetchSpec": "^8.3.2"
17
17
  },
18
18
  "_requiredBy": [
19
- "/sockjs"
19
+ "/node-red-contrib-web-worldmap/sockjs"
20
20
  ],
21
21
  "_resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
22
22
  "_shasum": "80d5b5ced271bb9af6c445f21a1a04c606cefbe2",
@@ -0,0 +1,14 @@
1
+ # HTTP Parser
2
+
3
+ ## 0.4.4
4
+
5
+ Made 'maxHeaderSize' configurable.
6
+
7
+ ```js
8
+ // Monkey patch before you require http for the first time.
9
+ process.binding('http_parser').HTTPParser = require('http-parser-js').HTTPParser;
10
+ require('http-parser-js').HTTPParser.maxHeaderSize = 1024 * 1024; // 1MB instead of 80kb
11
+
12
+ var http = require('http');
13
+ // ...
14
+ ```
@@ -0,0 +1,31 @@
1
+ # HTTP Parser
2
+
3
+ This library parses HTTP protocol for requests and responses. It was created to replace `http_parser.c` since calling C++ function from JS is really slow in V8. However, it is now primarily useful in having a more flexible/tolerant HTTP parser when dealing with legacy services that do not meet the strict HTTP parsing rules Node's parser follows.
4
+
5
+ This is packaged as a standalone npm module. To use in node, monkeypatch HTTPParser.
6
+
7
+ ```js
8
+ // Monkey patch before you require http for the first time.
9
+ process.binding('http_parser').HTTPParser = require('http-parser-js').HTTPParser;
10
+
11
+ var http = require('http');
12
+ // ...
13
+ ```
14
+
15
+ ## Testing
16
+
17
+ Simply do `npm test`. The tests are copied from node and mscedex/io.js, with some modifcations.
18
+
19
+ ## Status
20
+
21
+ This should now be usable in any node application, it now supports (nearly) everything `http_parser.c` does while still being tolerant with corrupted headers, and other kinds of malformed data.
22
+
23
+ ### Node Versions
24
+
25
+ `http-parser-js` should work via monkey-patching on Node v6-v11, and v13.
26
+
27
+ Node v12.x renamed the internal http parser, and did not expose it for monkey-patching, so to be able to monkey-patch on Node v12, you must run `node --http-parser=legacy file.js` to opt in to the old, monkey-patchable http_parser binding.
28
+
29
+ ## License
30
+
31
+ MIT. See LICENSE.md
@@ -33,13 +33,10 @@ HTTPParser.encoding = 'ascii';
33
33
  HTTPParser.maxHeaderSize = 80 * 1024; // maxHeaderSize (in bytes) is configurable, but 80kb by default;
34
34
  HTTPParser.REQUEST = 'REQUEST';
35
35
  HTTPParser.RESPONSE = 'RESPONSE';
36
-
37
- // Note: *not* starting with kOnHeaders=0 line the Node parser, because any
38
- // newly added constants (kOnTimeout in Node v12.19.0) will overwrite 0!
39
- var kOnHeaders = HTTPParser.kOnHeaders = 1;
40
- var kOnHeadersComplete = HTTPParser.kOnHeadersComplete = 2;
41
- var kOnBody = HTTPParser.kOnBody = 3;
42
- var kOnMessageComplete = HTTPParser.kOnMessageComplete = 4;
36
+ var kOnHeaders = HTTPParser.kOnHeaders = 0;
37
+ var kOnHeadersComplete = HTTPParser.kOnHeadersComplete = 1;
38
+ var kOnBody = HTTPParser.kOnBody = 2;
39
+ var kOnMessageComplete = HTTPParser.kOnMessageComplete = 3;
43
40
 
44
41
  // Some handler stubs, needed for compatibility
45
42
  HTTPParser.prototype[kOnHeaders] =
@@ -52,7 +49,7 @@ Object.defineProperty(HTTPParser, 'kOnExecute', {
52
49
  get: function () {
53
50
  // hack for backward compatibility
54
51
  compatMode0_12 = false;
55
- return 99;
52
+ return 4;
56
53
  }
57
54
  });
58
55