updater: better error message
This commit is contained in:
@@ -2,13 +2,24 @@
|
||||
|
||||
exports = module.exports = {
|
||||
disks,
|
||||
file
|
||||
file,
|
||||
prettyBytes
|
||||
};
|
||||
|
||||
const assert = require('assert'),
|
||||
BoxError = require('./boxerror.js'),
|
||||
safe = require('safetydance');
|
||||
|
||||
// binary units (non SI) 1024 based
|
||||
function prettyBytes(bytes) {
|
||||
assert.strictEqual(typeof bytes, 'number');
|
||||
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(1024)),
|
||||
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
||||
|
||||
return (bytes / Math.pow(1024, i)).toFixed(2) * 1 + '' + sizes[i];
|
||||
}
|
||||
|
||||
function parseLine(line) {
|
||||
const parts = line.split(/\s+/, 7); // this way the mountpoint can have spaces in it
|
||||
|
||||
|
||||
Reference in New Issue
Block a user