summaryrefslogtreecommitdiff
path: root/node_modules/pretty-bytes
diff options
context:
space:
mode:
authorArman Shah <[email protected]>2018-02-19 23:50:04 -0800
committerArman Shah <[email protected]>2018-02-19 23:50:04 -0800
commitae34dcfd3823a609ba7182f2d6eda593be876f7d (patch)
treeb9d7f2884c4999349418cbdc4f9ab46d113e0afd /node_modules/pretty-bytes
parentInitial commit (diff)
downloadlauncher-ae34dcfd3823a609ba7182f2d6eda593be876f7d.tar.xz
launcher-ae34dcfd3823a609ba7182f2d6eda593be876f7d.zip
add base files
Diffstat (limited to 'node_modules/pretty-bytes')
-rwxr-xr-xnode_modules/pretty-bytes/cli.js32
-rw-r--r--node_modules/pretty-bytes/license21
-rw-r--r--node_modules/pretty-bytes/package.json81
-rw-r--r--node_modules/pretty-bytes/pretty-bytes.js46
-rw-r--r--node_modules/pretty-bytes/readme.md60
5 files changed, 240 insertions, 0 deletions
diff --git a/node_modules/pretty-bytes/cli.js b/node_modules/pretty-bytes/cli.js
new file mode 100755
index 0000000..7ad15cd
--- /dev/null
+++ b/node_modules/pretty-bytes/cli.js
@@ -0,0 +1,32 @@
+#!/usr/bin/env node
+'use strict';
+var getStdin = require('get-stdin');
+var meow = require('meow');
+var prettyBytes = require('./pretty-bytes');
+
+var cli = meow({
+ help: [
+ 'Usage',
+ ' $ pretty-bytes <number>',
+ ' $ echo <number> | pretty-bytes',
+ '',
+ 'Example',
+ ' $ pretty-bytes 1337',
+ ' 1.34 kB'
+ ].join('\n')
+});
+
+function init(data) {
+ console.log(prettyBytes(Number(data)));
+}
+
+if (process.stdin.isTTY) {
+ if (!cli.input[0]) {
+ console.error('Number required');
+ process.exit(1);
+ }
+
+ init(cli.input[0]);
+} else {
+ getStdin(init);
+}
diff --git a/node_modules/pretty-bytes/license b/node_modules/pretty-bytes/license
new file mode 100644
index 0000000..654d0bf
--- /dev/null
+++ b/node_modules/pretty-bytes/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
+
+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/pretty-bytes/package.json b/node_modules/pretty-bytes/package.json
new file mode 100644
index 0000000..22c090e
--- /dev/null
+++ b/node_modules/pretty-bytes/package.json
@@ -0,0 +1,81 @@
+{
+ "_from": "pretty-bytes@^1.0.2",
+ "_id": "[email protected]",
+ "_inBundle": false,
+ "_integrity": "sha1-CiLoIQYJrTVUL4yNXSFZr/B1HIQ=",
+ "_location": "/pretty-bytes",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "pretty-bytes@^1.0.2",
+ "name": "pretty-bytes",
+ "escapedName": "pretty-bytes",
+ "rawSpec": "^1.0.2",
+ "saveSpec": null,
+ "fetchSpec": "^1.0.2"
+ },
+ "_requiredBy": [
+ "/nugget"
+ ],
+ "_resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-1.0.4.tgz",
+ "_shasum": "0a22e8210609ad35542f8c8d5d2159aff0751c84",
+ "_spec": "pretty-bytes@^1.0.2",
+ "_where": "/Users/armanshah/Desktop/node-projects/shopping-list/node_modules/nugget",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "[email protected]",
+ "url": "http://sindresorhus.com"
+ },
+ "bin": {
+ "pretty-bytes": "cli.js"
+ },
+ "bugs": {
+ "url": "https://github.com/sindresorhus/pretty-bytes/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "get-stdin": "^4.0.1",
+ "meow": "^3.1.0"
+ },
+ "deprecated": false,
+ "description": "Convert bytes to a human readable string: 1337 → 1.34 kB",
+ "devDependencies": {
+ "mocha": "*"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "files": [
+ "pretty-bytes.js",
+ "cli.js"
+ ],
+ "homepage": "https://github.com/sindresorhus/pretty-bytes#readme",
+ "keywords": [
+ "cli",
+ "bin",
+ "browser",
+ "pretty",
+ "bytes",
+ "byte",
+ "filesize",
+ "size",
+ "file",
+ "human",
+ "humanized",
+ "readable",
+ "si",
+ "data"
+ ],
+ "license": "MIT",
+ "main": "pretty-bytes.js",
+ "name": "pretty-bytes",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/sindresorhus/pretty-bytes.git"
+ },
+ "scripts": {
+ "test": "mocha"
+ },
+ "version": "1.0.4"
+}
diff --git a/node_modules/pretty-bytes/pretty-bytes.js b/node_modules/pretty-bytes/pretty-bytes.js
new file mode 100644
index 0000000..626c18a
--- /dev/null
+++ b/node_modules/pretty-bytes/pretty-bytes.js
@@ -0,0 +1,46 @@
+/*!
+ pretty-bytes
+ Convert bytes to a human readable string: 1337 → 1.34 kB
+ https://github.com/sindresorhus/pretty-bytes
+ by Sindre Sorhus
+ MIT License
+*/
+(function () {
+ 'use strict';
+
+ // Number.isNaN() polyfill
+ var isNaN = function (val) {
+ return val !== val;
+ };
+
+ var prettyBytes = function (num) {
+ if (typeof num !== 'number' || isNaN(num)) {
+ throw new TypeError('Expected a number');
+ }
+
+ var exponent;
+ var unit;
+ var neg = num < 0;
+ var units = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
+
+ if (neg) {
+ num = -num;
+ }
+
+ if (num < 1) {
+ return (neg ? '-' : '') + num + ' B';
+ }
+
+ exponent = Math.min(Math.floor(Math.log(num) / Math.log(1000)), units.length - 1);
+ num = (num / Math.pow(1000, exponent)).toFixed(2) * 1;
+ unit = units[exponent];
+
+ return (neg ? '-' : '') + num + ' ' + unit;
+ };
+
+ if (typeof module !== 'undefined' && module.exports) {
+ module.exports = prettyBytes;
+ } else {
+ self.prettyBytes = prettyBytes;
+ }
+})();
diff --git a/node_modules/pretty-bytes/readme.md b/node_modules/pretty-bytes/readme.md
new file mode 100644
index 0000000..bb94861
--- /dev/null
+++ b/node_modules/pretty-bytes/readme.md
@@ -0,0 +1,60 @@
+# pretty-bytes [![Build Status](https://travis-ci.org/sindresorhus/pretty-bytes.svg?branch=master)](https://travis-ci.org/sindresorhus/pretty-bytes)
+
+> Convert bytes to a human readable string: `1337` → `1.34 kB`
+
+Useful for displaying file sizes for humans.
+
+-
+
+*Note that it uses base-10 (eg. kilobyte).
+[Read about the difference between kilobyte and kibibyte.](http://pacoup.com/2009/05/26/kb-kb-kib-whats-up-with-that/)*
+
+
+## Install
+
+```
+$ npm install --save pretty-bytes
+```
+
+```
+$ bower install --save pretty-bytes
+```
+
+```
+$ component install sindresorhus/pretty-bytes
+```
+
+
+## Usage
+
+```js
+prettyBytes(1337);
+//=> '1.34 kB'
+
+prettyBytes(100);
+//=> '100 B'
+```
+
+
+## CLI
+
+```
+$ npm install --global pretty-bytes
+```
+
+```
+$ pretty-bytes --help
+
+ Usage
+ $ pretty-bytes <number>
+ $ echo <number> | pretty-bytes
+
+ Example
+ $ pretty-bytes 1337
+ 1.34 kB
+```
+
+
+## License
+
+MIT © [Sindre Sorhus](http://sindresorhus.com)