From 5fb03f8022576dd391a26ede67c8cc6b85661d47 Mon Sep 17 00:00:00 2001
From: Kai Reinhard <K.Reinhard@micromata.de>
Date: Sat, 15 Dec 2018 06:59:12 +0000
Subject: [PATCH] ...

---
 borgbutler-webapp/src/utilities/global.js |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/borgbutler-webapp/src/utilities/global.js b/borgbutler-webapp/src/utilities/global.js
index 0c50294..4faa037 100644
--- a/borgbutler-webapp/src/utilities/global.js
+++ b/borgbutler-webapp/src/utilities/global.js
@@ -41,6 +41,11 @@
     //return date.toLocaleDateString("de-DE", options);
 }
 
+export const humanFileSize = (size) => {
+    var i = Math.floor( Math.log(size) / Math.log(1024) );
+    return (size / Math.pow(1024, i) ).toLocaleString(undefined,{maximumFractionDigits: 2}) + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i];
+}
+
 export const revisedRandId = () => Math.random().toString(36).replace(/[^a-z]+/g, '').substr(2, 10);
 
 /* Checks if a given array is definied and is not empty. */

--
Gitblit v1.10.0