A lightweight Node.js package for file size conversion
npm install filesize-converter
Here's an example of how to use the filesize-converter package:
// Require the filesize-converter package
const filesizeConverter = require('filesize-converter');
// Convert bytes to kilobytes
console.log(filesizeConverter.bytesToKilobytes(1024)); // Output: 1
// Convert bytes to megabytes
console.log(filesizeConverter.bytesToMegabytes(1048576)); // Output: 1
// Convert bytes to gigabytes
console.log(filesizeConverter.bytesToGigabytes(1073741824)); // Output: 1
License: Apache-2.0