bytes-formatter 21.6.14 → 21.6.15

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 (3) hide show
  1. package/README.md +8 -2
  2. package/index.js +2 -2
  3. package/package.json +9 -6
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Build Status](https://github.com/vpodk/bytes-formatter/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/vpodk/bytes-formatter/actions/workflows/npm-publish.yml) [![License](https://img.shields.io/:license-apache-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) [![NPM version](https://img.shields.io/npm/v/bytes-formatter.svg?style=flat)](https://npmjs.org/package/bytes-formatter) [![NPM downloads](https://img.shields.io/npm/dm/bytes-formatter.svg?style=flat)](https://npmjs.org/package/bytes-formatter)
4
4
 
5
- Bytes formatter module.
5
+ Bytes formatter module provides a function to format byte values into human-readable strings with appropriate units (bytes, KB, MB, GB, TB, PB).
6
6
 
7
7
  ## Usage
8
8
 
@@ -20,5 +20,11 @@ import { formatBytes } from "bytes-formatter";
20
20
  * @param {number} bytes The bytes to be formatted.
21
21
  * @return {string} The formatted bytes as string.
22
22
  */
23
- console.log(formatBytes(1024)); // 1.0 KB
23
+ console.log(formatBytes(1000)); // "1000 bytes"
24
+ console.log(formatBytes(1024)); // "1.00 KB"
25
+ console.log(formatBytes(1000000)); // "976.56 KB"
26
+ console.log(formatBytes(2000000)); // "1.91 MB"
27
+ console.log(formatBytes(2000000000)); // "1.86 GB"
28
+ console.log(formatBytes(2000000000000)); // "1.82 TB"
29
+ console.log(formatBytes(Number.MAX_SAFE_INTEGER)); // "8.00 PB"
24
30
  ```
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @fileoverview Bytes formatter module
3
3
  *
4
- * @see https://google.github.io/styleguide/javascriptguide.xml
5
- * @see https://developers.google.com/closure/compiler/docs/js-for-compiler
4
+ * @see https://google.github.io/styleguide/jsguide.html
5
+ * @see https://google.github.io/styleguide/tsguide.html
6
6
  * @module bytes-formatter
7
7
  */
8
8
 
package/package.json CHANGED
@@ -1,12 +1,18 @@
1
1
  {
2
2
  "name": "bytes-formatter",
3
3
  "type": "module",
4
- "version": "21.6.14",
5
- "description": "Bytes formatter module",
6
- "homepage": "https://github.com/vpodk/bytes-formatter",
4
+ "version": "21.6.15",
5
+ "description": "Bytes formatter module provides a function to format byte values into human-readable strings with appropriate units (bytes, KB, MB, GB, TB, PB).",
6
+ "homepage": "https://vpodk.com/bytes-formatter/",
7
7
  "repository": {
8
8
  "url": "git+https://github.com/vpodk/bytes-formatter.git"
9
9
  },
10
+ "bugs": {
11
+ "url": "https://github.com/vpodk/bytes-formatter/issues"
12
+ },
13
+ "funding": {
14
+ "url": "https://github.com/sponsors/vpodk"
15
+ },
10
16
  "license": "Apache-2.0",
11
17
  "main": "./index.js",
12
18
  "exports": "./index.js",
@@ -14,9 +20,6 @@
14
20
  "scripts": {
15
21
  "test": "node ./index.tests.js"
16
22
  },
17
- "bugs": {
18
- "url": "https://github.com/vpodk/bytes-formatter/issues"
19
- },
20
23
  "author": {
21
24
  "name": "Valentin Podkamennyi",
22
25
  "email": "vpodk@users.noreply.github.com",