summaryrefslogtreecommitdiff
path: root/node_modules/pretty-bytes
diff options
context:
space:
mode:
authorLinuxWizard42 <computerwizard@linuxmail.org>2022-10-12 22:54:37 +0300
committerLinuxWizard42 <computerwizard@linuxmail.org>2022-10-12 22:54:37 +0300
commit703e03aba33f234712206769f57717ba7d92d23d (patch)
tree0041f04ccb75bd5379c764e9fe42249fffe75fc3 /node_modules/pretty-bytes
parentab6e257e6e9d9a483d7e86f220d8b209a2cd7753 (diff)
downloadFlashRunner-703e03aba33f234712206769f57717ba7d92d23d.tar.gz
FlashRunner-703e03aba33f234712206769f57717ba7d92d23d.tar.zst
Added export_allowed file to make repository visible in cgit
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.json49
-rw-r--r--node_modules/pretty-bytes/pretty-bytes.js46
-rw-r--r--node_modules/pretty-bytes/readme.md60
5 files changed, 208 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 <sindresorhus@gmail.com> (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..a75958d
--- /dev/null
+++ b/node_modules/pretty-bytes/package.json
@@ -0,0 +1,49 @@
+{
+ "name": "pretty-bytes",
+ "version": "1.0.4",
+ "description": "Convert bytes to a human readable string: 1337 → 1.34 kB",
+ "license": "MIT",
+ "repository": "sindresorhus/pretty-bytes",
+ "main": "pretty-bytes.js",
+ "bin": {
+ "pretty-bytes": "cli.js"
+ },
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "http://sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "scripts": {
+ "test": "mocha"
+ },
+ "files": [
+ "pretty-bytes.js",
+ "cli.js"
+ ],
+ "keywords": [
+ "cli",
+ "bin",
+ "browser",
+ "pretty",
+ "bytes",
+ "byte",
+ "filesize",
+ "size",
+ "file",
+ "human",
+ "humanized",
+ "readable",
+ "si",
+ "data"
+ ],
+ "dependencies": {
+ "get-stdin": "^4.0.1",
+ "meow": "^3.1.0"
+ },
+ "devDependencies": {
+ "mocha": "*"
+ }
+}
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)