node-red-contrib-web-worldmap 5.0.5 → 5.0.6
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.
- package/CHANGELOG.md +2 -2
- package/README.md +1 -1
- package/node_modules/accepts/node_modules/negotiator/HISTORY.md +108 -0
- package/node_modules/{body-parser/node_modules/bytes → accepts/node_modules/negotiator}/LICENSE +3 -2
- package/node_modules/accepts/node_modules/negotiator/README.md +203 -0
- package/node_modules/accepts/node_modules/negotiator/index.js +82 -0
- package/node_modules/accepts/node_modules/negotiator/lib/charset.js +169 -0
- package/node_modules/accepts/node_modules/negotiator/lib/encoding.js +184 -0
- package/node_modules/accepts/node_modules/negotiator/lib/language.js +179 -0
- package/node_modules/accepts/node_modules/negotiator/lib/mediaType.js +294 -0
- package/node_modules/accepts/node_modules/negotiator/package.json +42 -0
- package/node_modules/bytes/History.md +15 -0
- package/node_modules/bytes/Readme.md +45 -18
- package/node_modules/bytes/index.js +15 -4
- package/node_modules/bytes/package.json +7 -4
- package/node_modules/compression/HISTORY.md +15 -0
- package/node_modules/compression/README.md +4 -6
- package/node_modules/compression/index.js +3 -8
- package/node_modules/compression/package.json +19 -19
- package/node_modules/negotiator/HISTORY.md +5 -0
- package/node_modules/negotiator/README.md +9 -0
- package/node_modules/negotiator/index.js +4 -4
- package/node_modules/negotiator/lib/encoding.js +26 -5
- package/node_modules/negotiator/lib/mediaType.js +3 -3
- package/node_modules/negotiator/package.json +1 -1
- package/node_modules/object-inspect/CHANGELOG.md +12 -0
- package/node_modules/object-inspect/index.js +17 -3
- package/node_modules/object-inspect/package.json +6 -6
- package/node_modules/object-inspect/test/quoteStyle.js +9 -0
- package/node_modules/safe-buffer/index.js +3 -0
- package/node_modules/safe-buffer/package.json +18 -4
- package/node_modules/tslib/modules/index.d.ts +1 -0
- package/node_modules/tslib/modules/index.js +2 -0
- package/node_modules/tslib/package.json +1 -1
- package/node_modules/tslib/tslib.d.ts +7 -0
- package/node_modules/tslib/tslib.es6.js +24 -1
- package/node_modules/tslib/tslib.es6.mjs +24 -1
- package/node_modules/tslib/tslib.js +56 -1
- package/package.json +1 -1
- package/worldmap/worldmap.js +3 -0
- package/worldmap.js +2 -2
- package/node_modules/body-parser/node_modules/bytes/History.md +0 -97
- package/node_modules/body-parser/node_modules/bytes/Readme.md +0 -152
- package/node_modules/body-parser/node_modules/bytes/index.js +0 -170
- package/node_modules/body-parser/node_modules/bytes/package.json +0 -42
- package/node_modules/content-disposition/node_modules/safe-buffer/LICENSE +0 -21
- package/node_modules/content-disposition/node_modules/safe-buffer/README.md +0 -584
- package/node_modules/content-disposition/node_modules/safe-buffer/index.d.ts +0 -187
- package/node_modules/content-disposition/node_modules/safe-buffer/index.js +0 -65
- package/node_modules/content-disposition/node_modules/safe-buffer/package.json +0 -51
- package/node_modules/express/node_modules/safe-buffer/LICENSE +0 -21
- package/node_modules/express/node_modules/safe-buffer/README.md +0 -584
- package/node_modules/express/node_modules/safe-buffer/index.d.ts +0 -187
- package/node_modules/express/node_modules/safe-buffer/index.js +0 -65
- package/node_modules/express/node_modules/safe-buffer/package.json +0 -51
- package/node_modules/raw-body/node_modules/bytes/History.md +0 -97
- package/node_modules/raw-body/node_modules/bytes/LICENSE +0 -23
- package/node_modules/raw-body/node_modules/bytes/Readme.md +0 -152
- package/node_modules/raw-body/node_modules/bytes/index.js +0 -170
- package/node_modules/raw-body/node_modules/bytes/package.json +0 -42
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
declare module "safe-buffer" {
|
|
2
|
-
export class Buffer {
|
|
3
|
-
length: number
|
|
4
|
-
write(string: string, offset?: number, length?: number, encoding?: string): number;
|
|
5
|
-
toString(encoding?: string, start?: number, end?: number): string;
|
|
6
|
-
toJSON(): { type: 'Buffer', data: any[] };
|
|
7
|
-
equals(otherBuffer: Buffer): boolean;
|
|
8
|
-
compare(otherBuffer: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number;
|
|
9
|
-
copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
|
10
|
-
slice(start?: number, end?: number): Buffer;
|
|
11
|
-
writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
|
12
|
-
writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
|
13
|
-
writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
|
14
|
-
writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
|
15
|
-
readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
|
16
|
-
readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
|
17
|
-
readIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
|
18
|
-
readIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
|
19
|
-
readUInt8(offset: number, noAssert?: boolean): number;
|
|
20
|
-
readUInt16LE(offset: number, noAssert?: boolean): number;
|
|
21
|
-
readUInt16BE(offset: number, noAssert?: boolean): number;
|
|
22
|
-
readUInt32LE(offset: number, noAssert?: boolean): number;
|
|
23
|
-
readUInt32BE(offset: number, noAssert?: boolean): number;
|
|
24
|
-
readInt8(offset: number, noAssert?: boolean): number;
|
|
25
|
-
readInt16LE(offset: number, noAssert?: boolean): number;
|
|
26
|
-
readInt16BE(offset: number, noAssert?: boolean): number;
|
|
27
|
-
readInt32LE(offset: number, noAssert?: boolean): number;
|
|
28
|
-
readInt32BE(offset: number, noAssert?: boolean): number;
|
|
29
|
-
readFloatLE(offset: number, noAssert?: boolean): number;
|
|
30
|
-
readFloatBE(offset: number, noAssert?: boolean): number;
|
|
31
|
-
readDoubleLE(offset: number, noAssert?: boolean): number;
|
|
32
|
-
readDoubleBE(offset: number, noAssert?: boolean): number;
|
|
33
|
-
swap16(): Buffer;
|
|
34
|
-
swap32(): Buffer;
|
|
35
|
-
swap64(): Buffer;
|
|
36
|
-
writeUInt8(value: number, offset: number, noAssert?: boolean): number;
|
|
37
|
-
writeUInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
|
38
|
-
writeUInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
|
39
|
-
writeUInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
|
40
|
-
writeUInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
|
41
|
-
writeInt8(value: number, offset: number, noAssert?: boolean): number;
|
|
42
|
-
writeInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
|
43
|
-
writeInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
|
44
|
-
writeInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
|
45
|
-
writeInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
|
46
|
-
writeFloatLE(value: number, offset: number, noAssert?: boolean): number;
|
|
47
|
-
writeFloatBE(value: number, offset: number, noAssert?: boolean): number;
|
|
48
|
-
writeDoubleLE(value: number, offset: number, noAssert?: boolean): number;
|
|
49
|
-
writeDoubleBE(value: number, offset: number, noAssert?: boolean): number;
|
|
50
|
-
fill(value: any, offset?: number, end?: number): this;
|
|
51
|
-
indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
|
52
|
-
lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
|
53
|
-
includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Allocates a new buffer containing the given {str}.
|
|
57
|
-
*
|
|
58
|
-
* @param str String to store in buffer.
|
|
59
|
-
* @param encoding encoding to use, optional. Default is 'utf8'
|
|
60
|
-
*/
|
|
61
|
-
constructor (str: string, encoding?: string);
|
|
62
|
-
/**
|
|
63
|
-
* Allocates a new buffer of {size} octets.
|
|
64
|
-
*
|
|
65
|
-
* @param size count of octets to allocate.
|
|
66
|
-
*/
|
|
67
|
-
constructor (size: number);
|
|
68
|
-
/**
|
|
69
|
-
* Allocates a new buffer containing the given {array} of octets.
|
|
70
|
-
*
|
|
71
|
-
* @param array The octets to store.
|
|
72
|
-
*/
|
|
73
|
-
constructor (array: Uint8Array);
|
|
74
|
-
/**
|
|
75
|
-
* Produces a Buffer backed by the same allocated memory as
|
|
76
|
-
* the given {ArrayBuffer}.
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* @param arrayBuffer The ArrayBuffer with which to share memory.
|
|
80
|
-
*/
|
|
81
|
-
constructor (arrayBuffer: ArrayBuffer);
|
|
82
|
-
/**
|
|
83
|
-
* Allocates a new buffer containing the given {array} of octets.
|
|
84
|
-
*
|
|
85
|
-
* @param array The octets to store.
|
|
86
|
-
*/
|
|
87
|
-
constructor (array: any[]);
|
|
88
|
-
/**
|
|
89
|
-
* Copies the passed {buffer} data onto a new {Buffer} instance.
|
|
90
|
-
*
|
|
91
|
-
* @param buffer The buffer to copy.
|
|
92
|
-
*/
|
|
93
|
-
constructor (buffer: Buffer);
|
|
94
|
-
prototype: Buffer;
|
|
95
|
-
/**
|
|
96
|
-
* Allocates a new Buffer using an {array} of octets.
|
|
97
|
-
*
|
|
98
|
-
* @param array
|
|
99
|
-
*/
|
|
100
|
-
static from(array: any[]): Buffer;
|
|
101
|
-
/**
|
|
102
|
-
* When passed a reference to the .buffer property of a TypedArray instance,
|
|
103
|
-
* the newly created Buffer will share the same allocated memory as the TypedArray.
|
|
104
|
-
* The optional {byteOffset} and {length} arguments specify a memory range
|
|
105
|
-
* within the {arrayBuffer} that will be shared by the Buffer.
|
|
106
|
-
*
|
|
107
|
-
* @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer()
|
|
108
|
-
* @param byteOffset
|
|
109
|
-
* @param length
|
|
110
|
-
*/
|
|
111
|
-
static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
|
|
112
|
-
/**
|
|
113
|
-
* Copies the passed {buffer} data onto a new Buffer instance.
|
|
114
|
-
*
|
|
115
|
-
* @param buffer
|
|
116
|
-
*/
|
|
117
|
-
static from(buffer: Buffer): Buffer;
|
|
118
|
-
/**
|
|
119
|
-
* Creates a new Buffer containing the given JavaScript string {str}.
|
|
120
|
-
* If provided, the {encoding} parameter identifies the character encoding.
|
|
121
|
-
* If not provided, {encoding} defaults to 'utf8'.
|
|
122
|
-
*
|
|
123
|
-
* @param str
|
|
124
|
-
*/
|
|
125
|
-
static from(str: string, encoding?: string): Buffer;
|
|
126
|
-
/**
|
|
127
|
-
* Returns true if {obj} is a Buffer
|
|
128
|
-
*
|
|
129
|
-
* @param obj object to test.
|
|
130
|
-
*/
|
|
131
|
-
static isBuffer(obj: any): obj is Buffer;
|
|
132
|
-
/**
|
|
133
|
-
* Returns true if {encoding} is a valid encoding argument.
|
|
134
|
-
* Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
|
135
|
-
*
|
|
136
|
-
* @param encoding string to test.
|
|
137
|
-
*/
|
|
138
|
-
static isEncoding(encoding: string): boolean;
|
|
139
|
-
/**
|
|
140
|
-
* Gives the actual byte length of a string. encoding defaults to 'utf8'.
|
|
141
|
-
* This is not the same as String.prototype.length since that returns the number of characters in a string.
|
|
142
|
-
*
|
|
143
|
-
* @param string string to test.
|
|
144
|
-
* @param encoding encoding used to evaluate (defaults to 'utf8')
|
|
145
|
-
*/
|
|
146
|
-
static byteLength(string: string, encoding?: string): number;
|
|
147
|
-
/**
|
|
148
|
-
* Returns a buffer which is the result of concatenating all the buffers in the list together.
|
|
149
|
-
*
|
|
150
|
-
* If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
|
|
151
|
-
* If the list has exactly one item, then the first item of the list is returned.
|
|
152
|
-
* If the list has more than one item, then a new Buffer is created.
|
|
153
|
-
*
|
|
154
|
-
* @param list An array of Buffer objects to concatenate
|
|
155
|
-
* @param totalLength Total length of the buffers when concatenated.
|
|
156
|
-
* If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
|
|
157
|
-
*/
|
|
158
|
-
static concat(list: Buffer[], totalLength?: number): Buffer;
|
|
159
|
-
/**
|
|
160
|
-
* The same as buf1.compare(buf2).
|
|
161
|
-
*/
|
|
162
|
-
static compare(buf1: Buffer, buf2: Buffer): number;
|
|
163
|
-
/**
|
|
164
|
-
* Allocates a new buffer of {size} octets.
|
|
165
|
-
*
|
|
166
|
-
* @param size count of octets to allocate.
|
|
167
|
-
* @param fill if specified, buffer will be initialized by calling buf.fill(fill).
|
|
168
|
-
* If parameter is omitted, buffer will be filled with zeros.
|
|
169
|
-
* @param encoding encoding used for call to buf.fill while initalizing
|
|
170
|
-
*/
|
|
171
|
-
static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer;
|
|
172
|
-
/**
|
|
173
|
-
* Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
|
|
174
|
-
* of the newly created Buffer are unknown and may contain sensitive data.
|
|
175
|
-
*
|
|
176
|
-
* @param size count of octets to allocate
|
|
177
|
-
*/
|
|
178
|
-
static allocUnsafe(size: number): Buffer;
|
|
179
|
-
/**
|
|
180
|
-
* Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
|
|
181
|
-
* of the newly created Buffer are unknown and may contain sensitive data.
|
|
182
|
-
*
|
|
183
|
-
* @param size count of octets to allocate
|
|
184
|
-
*/
|
|
185
|
-
static allocUnsafeSlow(size: number): Buffer;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
2
|
-
/* eslint-disable node/no-deprecated-api */
|
|
3
|
-
var buffer = require('buffer')
|
|
4
|
-
var Buffer = buffer.Buffer
|
|
5
|
-
|
|
6
|
-
// alternative to using Object.keys for old browsers
|
|
7
|
-
function copyProps (src, dst) {
|
|
8
|
-
for (var key in src) {
|
|
9
|
-
dst[key] = src[key]
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
|
|
13
|
-
module.exports = buffer
|
|
14
|
-
} else {
|
|
15
|
-
// Copy properties from require('buffer')
|
|
16
|
-
copyProps(buffer, exports)
|
|
17
|
-
exports.Buffer = SafeBuffer
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function SafeBuffer (arg, encodingOrOffset, length) {
|
|
21
|
-
return Buffer(arg, encodingOrOffset, length)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
SafeBuffer.prototype = Object.create(Buffer.prototype)
|
|
25
|
-
|
|
26
|
-
// Copy static methods from Buffer
|
|
27
|
-
copyProps(Buffer, SafeBuffer)
|
|
28
|
-
|
|
29
|
-
SafeBuffer.from = function (arg, encodingOrOffset, length) {
|
|
30
|
-
if (typeof arg === 'number') {
|
|
31
|
-
throw new TypeError('Argument must not be a number')
|
|
32
|
-
}
|
|
33
|
-
return Buffer(arg, encodingOrOffset, length)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
SafeBuffer.alloc = function (size, fill, encoding) {
|
|
37
|
-
if (typeof size !== 'number') {
|
|
38
|
-
throw new TypeError('Argument must be a number')
|
|
39
|
-
}
|
|
40
|
-
var buf = Buffer(size)
|
|
41
|
-
if (fill !== undefined) {
|
|
42
|
-
if (typeof encoding === 'string') {
|
|
43
|
-
buf.fill(fill, encoding)
|
|
44
|
-
} else {
|
|
45
|
-
buf.fill(fill)
|
|
46
|
-
}
|
|
47
|
-
} else {
|
|
48
|
-
buf.fill(0)
|
|
49
|
-
}
|
|
50
|
-
return buf
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
SafeBuffer.allocUnsafe = function (size) {
|
|
54
|
-
if (typeof size !== 'number') {
|
|
55
|
-
throw new TypeError('Argument must be a number')
|
|
56
|
-
}
|
|
57
|
-
return Buffer(size)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
SafeBuffer.allocUnsafeSlow = function (size) {
|
|
61
|
-
if (typeof size !== 'number') {
|
|
62
|
-
throw new TypeError('Argument must be a number')
|
|
63
|
-
}
|
|
64
|
-
return buffer.SlowBuffer(size)
|
|
65
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "safe-buffer",
|
|
3
|
-
"description": "Safer Node.js Buffer API",
|
|
4
|
-
"version": "5.2.1",
|
|
5
|
-
"author": {
|
|
6
|
-
"name": "Feross Aboukhadijeh",
|
|
7
|
-
"email": "feross@feross.org",
|
|
8
|
-
"url": "https://feross.org"
|
|
9
|
-
},
|
|
10
|
-
"bugs": {
|
|
11
|
-
"url": "https://github.com/feross/safe-buffer/issues"
|
|
12
|
-
},
|
|
13
|
-
"devDependencies": {
|
|
14
|
-
"standard": "*",
|
|
15
|
-
"tape": "^5.0.0"
|
|
16
|
-
},
|
|
17
|
-
"homepage": "https://github.com/feross/safe-buffer",
|
|
18
|
-
"keywords": [
|
|
19
|
-
"buffer",
|
|
20
|
-
"buffer allocate",
|
|
21
|
-
"node security",
|
|
22
|
-
"safe",
|
|
23
|
-
"safe-buffer",
|
|
24
|
-
"security",
|
|
25
|
-
"uninitialized"
|
|
26
|
-
],
|
|
27
|
-
"license": "MIT",
|
|
28
|
-
"main": "index.js",
|
|
29
|
-
"types": "index.d.ts",
|
|
30
|
-
"repository": {
|
|
31
|
-
"type": "git",
|
|
32
|
-
"url": "git://github.com/feross/safe-buffer.git"
|
|
33
|
-
},
|
|
34
|
-
"scripts": {
|
|
35
|
-
"test": "standard && tape test/*.js"
|
|
36
|
-
},
|
|
37
|
-
"funding": [
|
|
38
|
-
{
|
|
39
|
-
"type": "github",
|
|
40
|
-
"url": "https://github.com/sponsors/feross"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"type": "patreon",
|
|
44
|
-
"url": "https://www.patreon.com/feross"
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"type": "consulting",
|
|
48
|
-
"url": "https://feross.org/support"
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
3.1.2 / 2022-01-27
|
|
2
|
-
==================
|
|
3
|
-
|
|
4
|
-
* Fix return value for un-parsable strings
|
|
5
|
-
|
|
6
|
-
3.1.1 / 2021-11-15
|
|
7
|
-
==================
|
|
8
|
-
|
|
9
|
-
* Fix "thousandsSeparator" incorrecting formatting fractional part
|
|
10
|
-
|
|
11
|
-
3.1.0 / 2019-01-22
|
|
12
|
-
==================
|
|
13
|
-
|
|
14
|
-
* Add petabyte (`pb`) support
|
|
15
|
-
|
|
16
|
-
3.0.0 / 2017-08-31
|
|
17
|
-
==================
|
|
18
|
-
|
|
19
|
-
* Change "kB" to "KB" in format output
|
|
20
|
-
* Remove support for Node.js 0.6
|
|
21
|
-
* Remove support for ComponentJS
|
|
22
|
-
|
|
23
|
-
2.5.0 / 2017-03-24
|
|
24
|
-
==================
|
|
25
|
-
|
|
26
|
-
* Add option "unit"
|
|
27
|
-
|
|
28
|
-
2.4.0 / 2016-06-01
|
|
29
|
-
==================
|
|
30
|
-
|
|
31
|
-
* Add option "unitSeparator"
|
|
32
|
-
|
|
33
|
-
2.3.0 / 2016-02-15
|
|
34
|
-
==================
|
|
35
|
-
|
|
36
|
-
* Drop partial bytes on all parsed units
|
|
37
|
-
* Fix non-finite numbers to `.format` to return `null`
|
|
38
|
-
* Fix parsing byte string that looks like hex
|
|
39
|
-
* perf: hoist regular expressions
|
|
40
|
-
|
|
41
|
-
2.2.0 / 2015-11-13
|
|
42
|
-
==================
|
|
43
|
-
|
|
44
|
-
* add option "decimalPlaces"
|
|
45
|
-
* add option "fixedDecimals"
|
|
46
|
-
|
|
47
|
-
2.1.0 / 2015-05-21
|
|
48
|
-
==================
|
|
49
|
-
|
|
50
|
-
* add `.format` export
|
|
51
|
-
* add `.parse` export
|
|
52
|
-
|
|
53
|
-
2.0.2 / 2015-05-20
|
|
54
|
-
==================
|
|
55
|
-
|
|
56
|
-
* remove map recreation
|
|
57
|
-
* remove unnecessary object construction
|
|
58
|
-
|
|
59
|
-
2.0.1 / 2015-05-07
|
|
60
|
-
==================
|
|
61
|
-
|
|
62
|
-
* fix browserify require
|
|
63
|
-
* remove node.extend dependency
|
|
64
|
-
|
|
65
|
-
2.0.0 / 2015-04-12
|
|
66
|
-
==================
|
|
67
|
-
|
|
68
|
-
* add option "case"
|
|
69
|
-
* add option "thousandsSeparator"
|
|
70
|
-
* return "null" on invalid parse input
|
|
71
|
-
* support proper round-trip: bytes(bytes(num)) === num
|
|
72
|
-
* units no longer case sensitive when parsing
|
|
73
|
-
|
|
74
|
-
1.0.0 / 2014-05-05
|
|
75
|
-
==================
|
|
76
|
-
|
|
77
|
-
* add negative support. fixes #6
|
|
78
|
-
|
|
79
|
-
0.3.0 / 2014-03-19
|
|
80
|
-
==================
|
|
81
|
-
|
|
82
|
-
* added terabyte support
|
|
83
|
-
|
|
84
|
-
0.2.1 / 2013-04-01
|
|
85
|
-
==================
|
|
86
|
-
|
|
87
|
-
* add .component
|
|
88
|
-
|
|
89
|
-
0.2.0 / 2012-10-28
|
|
90
|
-
==================
|
|
91
|
-
|
|
92
|
-
* bytes(200).should.eql('200b')
|
|
93
|
-
|
|
94
|
-
0.1.0 / 2012-07-04
|
|
95
|
-
==================
|
|
96
|
-
|
|
97
|
-
* add bytes to string conversion [yields]
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
(The MIT License)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2012-2014 TJ Holowaychuk <tj@vision-media.ca>
|
|
4
|
-
Copyright (c) 2015 Jed Watson <jed.watson@me.com>
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
-
a copy of this software and associated documentation files (the
|
|
8
|
-
'Software'), to deal in the Software without restriction, including
|
|
9
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
10
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
11
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
12
|
-
the following conditions:
|
|
13
|
-
|
|
14
|
-
The above copyright notice and this permission notice shall be
|
|
15
|
-
included in all copies or substantial portions of the Software.
|
|
16
|
-
|
|
17
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
19
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
20
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
21
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
22
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
23
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
# Bytes utility
|
|
2
|
-
|
|
3
|
-
[![NPM Version][npm-image]][npm-url]
|
|
4
|
-
[![NPM Downloads][downloads-image]][downloads-url]
|
|
5
|
-
[![Build Status][ci-image]][ci-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(number|string value, [options]): number|string|null
|
|
27
|
-
|
|
28
|
-
Default export function. Delegates to either `bytes.format` or `bytes.parse` based on the type of `value`.
|
|
29
|
-
|
|
30
|
-
**Arguments**
|
|
31
|
-
|
|
32
|
-
| Name | Type | Description |
|
|
33
|
-
|---------|----------|--------------------|
|
|
34
|
-
| value | `number`|`string` | Number value to format or string value to parse |
|
|
35
|
-
| options | `Object` | Conversion options for `format` |
|
|
36
|
-
|
|
37
|
-
**Returns**
|
|
38
|
-
|
|
39
|
-
| Name | Type | Description |
|
|
40
|
-
|---------|------------------|-------------------------------------------------|
|
|
41
|
-
| results | `string`|`number`|`null` | Return null upon error. Numeric value in bytes, or string value otherwise. |
|
|
42
|
-
|
|
43
|
-
**Example**
|
|
44
|
-
|
|
45
|
-
```js
|
|
46
|
-
bytes(1024);
|
|
47
|
-
// output: '1KB'
|
|
48
|
-
|
|
49
|
-
bytes('1KB');
|
|
50
|
-
// output: 1024
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
#### bytes.format(number value, [options]): string|null
|
|
54
|
-
|
|
55
|
-
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
|
|
56
|
-
rounded.
|
|
57
|
-
|
|
58
|
-
**Arguments**
|
|
59
|
-
|
|
60
|
-
| Name | Type | Description |
|
|
61
|
-
|---------|----------|--------------------|
|
|
62
|
-
| value | `number` | Value in bytes |
|
|
63
|
-
| options | `Object` | Conversion options |
|
|
64
|
-
|
|
65
|
-
**Options**
|
|
66
|
-
|
|
67
|
-
| Property | Type | Description |
|
|
68
|
-
|-------------------|--------|-----------------------------------------------------------------------------------------|
|
|
69
|
-
| decimalPlaces | `number`|`null` | Maximum number of decimal places to include in output. Default value to `2`. |
|
|
70
|
-
| fixedDecimals | `boolean`|`null` | Whether to always display the maximum number of decimal places. Default value to `false` |
|
|
71
|
-
| thousandsSeparator | `string`|`null` | Example of values: `' '`, `','` and `'.'`... Default value to `''`. |
|
|
72
|
-
| unit | `string`|`null` | The unit in which the result will be returned (B/KB/MB/GB/TB). Default value to `''` (which means auto detect). |
|
|
73
|
-
| unitSeparator | `string`|`null` | Separator to use between number and unit. Default value to `''`. |
|
|
74
|
-
|
|
75
|
-
**Returns**
|
|
76
|
-
|
|
77
|
-
| Name | Type | Description |
|
|
78
|
-
|---------|------------------|-------------------------------------------------|
|
|
79
|
-
| results | `string`|`null` | Return null upon error. String value otherwise. |
|
|
80
|
-
|
|
81
|
-
**Example**
|
|
82
|
-
|
|
83
|
-
```js
|
|
84
|
-
bytes.format(1024);
|
|
85
|
-
// output: '1KB'
|
|
86
|
-
|
|
87
|
-
bytes.format(1000);
|
|
88
|
-
// output: '1000B'
|
|
89
|
-
|
|
90
|
-
bytes.format(1000, {thousandsSeparator: ' '});
|
|
91
|
-
// output: '1 000B'
|
|
92
|
-
|
|
93
|
-
bytes.format(1024 * 1.7, {decimalPlaces: 0});
|
|
94
|
-
// output: '2KB'
|
|
95
|
-
|
|
96
|
-
bytes.format(1024, {unitSeparator: ' '});
|
|
97
|
-
// output: '1 KB'
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
#### bytes.parse(string|number value): number|null
|
|
101
|
-
|
|
102
|
-
Parse the string value into an integer in bytes. If no unit is given, or `value`
|
|
103
|
-
is a number, it is assumed the value is in bytes.
|
|
104
|
-
|
|
105
|
-
Supported units and abbreviations are as follows and are case-insensitive:
|
|
106
|
-
|
|
107
|
-
* `b` for bytes
|
|
108
|
-
* `kb` for kilobytes
|
|
109
|
-
* `mb` for megabytes
|
|
110
|
-
* `gb` for gigabytes
|
|
111
|
-
* `tb` for terabytes
|
|
112
|
-
* `pb` for petabytes
|
|
113
|
-
|
|
114
|
-
The units are in powers of two, not ten. This means 1kb = 1024b according to this parser.
|
|
115
|
-
|
|
116
|
-
**Arguments**
|
|
117
|
-
|
|
118
|
-
| Name | Type | Description |
|
|
119
|
-
|---------------|--------|--------------------|
|
|
120
|
-
| value | `string`|`number` | String to parse, or number in bytes. |
|
|
121
|
-
|
|
122
|
-
**Returns**
|
|
123
|
-
|
|
124
|
-
| Name | Type | Description |
|
|
125
|
-
|---------|-------------|-------------------------|
|
|
126
|
-
| results | `number`|`null` | Return null upon error. Value in bytes otherwise. |
|
|
127
|
-
|
|
128
|
-
**Example**
|
|
129
|
-
|
|
130
|
-
```js
|
|
131
|
-
bytes.parse('1KB');
|
|
132
|
-
// output: 1024
|
|
133
|
-
|
|
134
|
-
bytes.parse('1024');
|
|
135
|
-
// output: 1024
|
|
136
|
-
|
|
137
|
-
bytes.parse(1024);
|
|
138
|
-
// output: 1024
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
## License
|
|
142
|
-
|
|
143
|
-
[MIT](LICENSE)
|
|
144
|
-
|
|
145
|
-
[ci-image]: https://badgen.net/github/checks/visionmedia/bytes.js/master?label=ci
|
|
146
|
-
[ci-url]: https://github.com/visionmedia/bytes.js/actions?query=workflow%3Aci
|
|
147
|
-
[coveralls-image]: https://badgen.net/coveralls/c/github/visionmedia/bytes.js/master
|
|
148
|
-
[coveralls-url]: https://coveralls.io/r/visionmedia/bytes.js?branch=master
|
|
149
|
-
[downloads-image]: https://badgen.net/npm/dm/bytes
|
|
150
|
-
[downloads-url]: https://npmjs.org/package/bytes
|
|
151
|
-
[npm-image]: https://badgen.net/npm/v/bytes
|
|
152
|
-
[npm-url]: https://npmjs.org/package/bytes
|