ars-formatbytes
v1.0.0
Published
`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.
Downloads
50
Maintainers
Readme
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.