UNPKG

@octopusdeploy/octojs

Version:

A nodejs cli tool for packaging and pushing projects to an Octopus Deploy instance.

8 lines 312 B
module.exports = function bytesToSize(bytes) { var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']; if (bytes === 0) { return '0 Byte'; } var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))); return (Math.round((bytes / Math.pow(1024, i)) * 100) / 100) + ' ' + sizes[i]; };