-
-
+
{{ app.selection.getDrive().name }} - {{ app.selection.getDrive().size | gigabyte | number:1 }} GB
diff --git a/lib/gui/utils/byte-size/byte-size.js b/lib/gui/utils/byte-size/byte-size.js
new file mode 100644
index 00000000..68db428b
--- /dev/null
+++ b/lib/gui/utils/byte-size/byte-size.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016 Resin.io
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+/**
+ * @module Etcher.Utils.ByteSize
+ *
+ * The purpose of this module is to provide utilities
+ * to work with sizes in bytes.
+ */
+
+const angular = require('angular');
+const MODULE_NAME = 'Etcher.Utils.ByteSize';
+const ByteSize = angular.module(MODULE_NAME, []);
+ByteSize.filter('gigabyte', require('./filters/gigabyte'));
+
+module.exports = MODULE_NAME;
diff --git a/lib/gui/utils/byte-size/filters/gigabyte.js b/lib/gui/utils/byte-size/filters/gigabyte.js
new file mode 100644
index 00000000..7efc9385
--- /dev/null
+++ b/lib/gui/utils/byte-size/filters/gigabyte.js
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2016 Resin.io
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+
+module.exports = function() {
+
+ /**
+ * @summary Convert bytes to gigabytes
+ * @function
+ * @public
+ *
+ * @param {Number} bytes - bytes
+ * @returns {Number} gigabytes
+ *
+ * @example
+ * {{ 7801405440 | gigabytes }}
+ */
+ return function(bytes) {
+ return bytes / 1000000000;
+ };
+
+};
diff --git a/package.json b/package.json
index 5555181e..be1c22a8 100644
--- a/package.json
+++ b/package.json
@@ -55,7 +55,7 @@
"bluebird": "^3.0.5",
"bootstrap-sass": "^3.3.5",
"chalk": "^1.1.3",
- "drivelist": "^2.0.13",
+ "drivelist": "^3.0.0",
"flexboxgrid": "^6.3.0",
"is-elevated": "^1.0.0",
"lodash": "^4.5.1",
diff --git a/tests/gui/utils/byte-size.spec.js b/tests/gui/utils/byte-size.spec.js
new file mode 100644
index 00000000..668af229
--- /dev/null
+++ b/tests/gui/utils/byte-size.spec.js
@@ -0,0 +1,28 @@
+'use strict';
+
+const m = require('mochainon');
+const angular = require('angular');
+const os = require('os');
+require('angular-mocks');
+
+describe('Browser: ByteSize', function() {
+
+ beforeEach(angular.mock.module(
+ require('../../../lib/gui/utils/byte-size/byte-size')
+ ));
+
+ describe('GigabyteFilter', function() {
+
+ let gigabyteFilter;
+
+ beforeEach(angular.mock.inject(function(_gigabyteFilter_) {
+ gigabyteFilter = _gigabyteFilter_;
+ }));
+
+ it('should convert bytes to gigabytes', function() {
+ m.chai.expect(gigabyteFilter(7801405440)).to.equal(7.80140544);
+ m.chai.expect(gigabyteFilter(100000000)).to.equal(0.1);
+ });
+
+ });
+});