1.0.0 • Published 2 years ago

ars-formatbytes v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

ars-formatbytes Library

ars-formatbytes is a lightweight, simple-to-use JavaScript library for converting byte values into human-readable formats. It supports formats from Bytes to Yottabytes.

Installation

Install ars-formatbytes using npm:

npm install ars-formatbytes

Usage

Here's a quick example to get you started:

const formatBytes = require('ars-formatbytes');  

const fileSize = formatBytes(15360); // 15 KB
console.log(fileSize);

const largeFileSize = formatBytes(1073741824); // 1 GB
console.log(largeFileSize);

formatBytes function accepts two arguments:

  • bytes (required): The size in bytes.
  • decimals (optional): Number of decimal places to format the output. Default is 2.

Features

  • Easy-to-use: Simple API with only two parameters.
  • Lightweight with no dependencies.
  • Covers a wide range of sizes from Bytes to Yottabytes.

Contributing

Contributions are welcome, and any feedback or suggestions are greatly appreciated!

License

This project is licensed under the MIT License.

1.0.0

2 years ago