diff --git a/src/pretty-bytes.js b/src/pretty-bytes.js deleted file mode 100644 index b96e99ea0..000000000 --- a/src/pretty-bytes.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -exports = module.exports = prettyByteSize; - -const assert = require('assert'); - -// binary units (non SI) 1024 based -function prettyByteSize(size) { - assert.strictEqual(typeof size, 'number'); - - if (!size) return 0; - - const i = Math.floor(Math.log(size) / Math.log(1024)); - return (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i]; -} diff --git a/src/storage/filesystem.js b/src/storage/filesystem.js index 9c3bc50d7..41947eaf5 100644 --- a/src/storage/filesystem.js +++ b/src/storage/filesystem.js @@ -40,7 +40,6 @@ const assert = require('assert'), mounts = require('../mounts.js'), path = require('path'), paths = require('../paths.js'), - prettyBytes = require('../pretty-bytes.js'), readdirp = require('readdirp'), safe = require('safetydance'), shell = require('../shell.js'); @@ -62,6 +61,16 @@ function getRootPath(apiConfig) { } } +// binary units (non SI) 1024 based +function prettyBytes(size) { + assert.strictEqual(typeof size, 'number'); + + if (!size) return 0; + + const i = Math.floor(Math.log(size) / Math.log(1024)); + return (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i]; +} + // the du call in the function below requires root async function checkPreconditions(apiConfig, dataLayout) { assert.strictEqual(typeof apiConfig, 'object');