@nacho-cs/byte-sized
v1.0.4
Published
A tiny library to easily convert exact byte measurements to a file size and vice versa
Downloads
3
Readme
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