aboutsummaryrefslogtreecommitdiff
path: root/node_modules/bytes
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-10-10 03:43:44 +0200
committerFlorian Dold <florian.dold@gmail.com>2016-10-10 03:43:44 +0200
commitabd94a7f5a50f43c797a11b53549ae48fff667c3 (patch)
treeab8ed457f65cdd72e13e0571d2975729428f1551 /node_modules/bytes
parenta0247c6a3fd6a09a41a7e35a3441324c4dcb58be (diff)
add node_modules to address #4364
Diffstat (limited to 'node_modules/bytes')
-rw-r--r--node_modules/bytes/.npmignore1
-rw-r--r--node_modules/bytes/History.md20
-rw-r--r--node_modules/bytes/Makefile7
-rw-r--r--node_modules/bytes/Readme.md54
-rw-r--r--node_modules/bytes/component.json7
-rw-r--r--node_modules/bytes/index.js41
-rw-r--r--node_modules/bytes/package.json83
7 files changed, 213 insertions, 0 deletions
diff --git a/node_modules/bytes/.npmignore b/node_modules/bytes/.npmignore
new file mode 100644
index 000000000..9daeafb98
--- /dev/null
+++ b/node_modules/bytes/.npmignore
@@ -0,0 +1 @@
+test
diff --git a/node_modules/bytes/History.md b/node_modules/bytes/History.md
new file mode 100644
index 000000000..b93e41fa0
--- /dev/null
+++ b/node_modules/bytes/History.md
@@ -0,0 +1,20 @@
+
+0.3.0 / 2014-03-19
+==================
+
+ * added terabyte support
+
+0.2.1 / 2013-04-01
+==================
+
+ * add .component
+
+0.2.0 / 2012-10-28
+==================
+
+ * bytes(200).should.eql('200b')
+
+0.1.0 / 2012-07-04
+==================
+
+ * add bytes to string conversion [yields]
diff --git a/node_modules/bytes/Makefile b/node_modules/bytes/Makefile
new file mode 100644
index 000000000..8e8640f2e
--- /dev/null
+++ b/node_modules/bytes/Makefile
@@ -0,0 +1,7 @@
+
+test:
+ @./node_modules/.bin/mocha \
+ --reporter spec \
+ --require should
+
+.PHONY: test \ No newline at end of file
diff --git a/node_modules/bytes/Readme.md b/node_modules/bytes/Readme.md
new file mode 100644
index 000000000..5591b28fb
--- /dev/null
+++ b/node_modules/bytes/Readme.md
@@ -0,0 +1,54 @@
+# node-bytes
+
+ Byte string parser / formatter.
+
+## Example:
+
+```js
+bytes('1kb')
+// => 1024
+
+bytes('2mb')
+// => 2097152
+
+bytes('1gb')
+// => 1073741824
+
+bytes(1073741824)
+// => 1gb
+
+bytes(1099511627776)
+// => 1tb
+```
+
+## Installation
+
+```
+$ npm install bytes
+$ component install visionmedia/bytes.js
+```
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2012 TJ Holowaychuk &lt;tj@vision-media.ca&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/bytes/component.json b/node_modules/bytes/component.json
new file mode 100644
index 000000000..2929c25d6
--- /dev/null
+++ b/node_modules/bytes/component.json
@@ -0,0 +1,7 @@
+{
+ "name": "bytes",
+ "description": "byte size string parser / serializer",
+ "keywords": ["bytes", "utility"],
+ "version": "0.2.1",
+ "scripts": ["index.js"]
+}
diff --git a/node_modules/bytes/index.js b/node_modules/bytes/index.js
new file mode 100644
index 000000000..02bd98f0d
--- /dev/null
+++ b/node_modules/bytes/index.js
@@ -0,0 +1,41 @@
+
+/**
+ * Parse byte `size` string.
+ *
+ * @param {String} size
+ * @return {Number}
+ * @api public
+ */
+
+module.exports = function(size) {
+ if ('number' == typeof size) return convert(size);
+ var parts = size.match(/^(\d+(?:\.\d+)?) *(kb|mb|gb|tb)$/)
+ , n = parseFloat(parts[1])
+ , type = parts[2];
+
+ var map = {
+ kb: 1 << 10
+ , mb: 1 << 20
+ , gb: 1 << 30
+ , tb: ((1 << 30) * 1024)
+ };
+
+ return map[type] * n;
+};
+
+/**
+ * convert bytes into string.
+ *
+ * @param {Number} b - bytes to convert
+ * @return {String}
+ * @api public
+ */
+
+function convert (b) {
+ var tb = ((1 << 30) * 1024), gb = 1 << 30, mb = 1 << 20, kb = 1 << 10;
+ if (b >= tb) return (Math.round(b / tb * 100) / 100) + 'tb';
+ if (b >= gb) return (Math.round(b / gb * 100) / 100) + 'gb';
+ if (b >= mb) return (Math.round(b / mb * 100) / 100) + 'mb';
+ if (b >= kb) return (Math.round(b / kb * 100) / 100) + 'kb';
+ return b + 'b';
+}
diff --git a/node_modules/bytes/package.json b/node_modules/bytes/package.json
new file mode 100644
index 000000000..b3a37907b
--- /dev/null
+++ b/node_modules/bytes/package.json
@@ -0,0 +1,83 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "bytes@^0.3.0",
+ "scope": null,
+ "escapedName": "bytes",
+ "name": "bytes",
+ "rawSpec": "^0.3.0",
+ "spec": ">=0.3.0 <0.4.0",
+ "type": "range"
+ },
+ "/home/dold/repos/taler/wallet-webex/node_modules/gulp-gzip"
+ ]
+ ],
+ "_from": "bytes@>=0.3.0 <0.4.0",
+ "_id": "bytes@0.3.0",
+ "_inCache": true,
+ "_location": "/bytes",
+ "_npmUser": {
+ "name": "tjholowaychuk",
+ "email": "tj@vision-media.ca"
+ },
+ "_npmVersion": "1.3.15",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "bytes@^0.3.0",
+ "scope": null,
+ "escapedName": "bytes",
+ "name": "bytes",
+ "rawSpec": "^0.3.0",
+ "spec": ">=0.3.0 <0.4.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/gulp-gzip"
+ ],
+ "_resolved": "https://registry.npmjs.org/bytes/-/bytes-0.3.0.tgz",
+ "_shasum": "78e2e0e28c7f9c7b988ea8aee0db4d5fa9941935",
+ "_shrinkwrap": null,
+ "_spec": "bytes@^0.3.0",
+ "_where": "/home/dold/repos/taler/wallet-webex/node_modules/gulp-gzip",
+ "author": {
+ "name": "TJ Holowaychuk",
+ "email": "tj@vision-media.ca",
+ "url": "http://tjholowaychuk.com"
+ },
+ "bugs": {
+ "url": "https://github.com/visionmedia/bytes.js/issues"
+ },
+ "component": {
+ "scripts": {
+ "bytes/index.js": "index.js"
+ }
+ },
+ "dependencies": {},
+ "description": "byte size string parser / serializer",
+ "devDependencies": {
+ "mocha": "*",
+ "should": "*"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "78e2e0e28c7f9c7b988ea8aee0db4d5fa9941935",
+ "tarball": "https://registry.npmjs.org/bytes/-/bytes-0.3.0.tgz"
+ },
+ "homepage": "https://github.com/visionmedia/bytes.js",
+ "main": "index.js",
+ "maintainers": [
+ {
+ "name": "tjholowaychuk",
+ "email": "tj@vision-media.ca"
+ }
+ ],
+ "name": "bytes",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/visionmedia/bytes.js.git"
+ },
+ "version": "0.3.0"
+}