diff --git a/static/sdk.js b/static/sdk.js index 11aa7f9..5662a79 100644 --- a/static/sdk.js +++ b/static/sdk.js @@ -5,8 +5,15 @@ var contented = (function ($, currentScriptPath) { var baseURL = currentScriptPath.replace('sdk.js', ''); var formatBytes = function(bytes) { - // FIXME - return Math.floor(bytes / (1024 * 1024)) + " MiB"; + if (bytes < 1024) { + return bytes + " B"; + } else if (bytes < (1024*1024)) { + return (bytes / 1024).toFixed(1) + " KiB"; + } else if (bytes < (1024*1024*1024)) { + return (bytes / (1024*1024)).toFixed(1) + " MiB"; + } else { + return (bytes / (1024*1024*1024)).toFixed(1) + " GiB"; + } }; /**