@nacho-cs/byte-sized

1.0.4 • Public • Published

byte-size

Easily convert an exact byte measurement to a file size and vice versa


Install:

Run:

$ npm i byte-size

Then add either:

import bytes from "byte-sized"; // ES6

or

const bytes = require("byte-sized"); // CommonJS

to your JS code


How to use

From there, simply call the function bytesize() and pass in a value, going up to petabytes

import bytes from "byte-sized";
console.log(bytes(696969)); // 680.63 KB
console.log(bytes("69 KB")); // 70656 bytes

Readme

Keywords

Package Sidebar

Install

npm i @nacho-cs/byte-sized

Weekly Downloads

0

Version

1.0.4

License

ISC

Unpacked Size

2.1 kB

Total Files

3

Last publish

Collaborators

  • nacho-cs