Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions addon/objects/FileSize.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ import Ember from 'ember';
export default Ember.Object.extend({
bytes: 0,


kb: Ember.computed('bytes', function () {
return this.get('bytes') / 1000;
return (this.get('bytes') / 1000).toFixed(2);
}),
mb: Ember.computed('bytes', function () {
return this.get('bytes') / Math.pow(1000, 2);
return (this.get('bytes') / Math.pow(1000, 2)).toFixed(2);
}),
gb: Ember.computed('bytes', function () {
return this.get('bytes') / Math.pow(1000, 3);
return (this.get('bytes') / Math.pow(1000, 3)).toFixed(2);
}),
tb: Ember.computed('bytes', function () {
return this.get('bytes') / Math.pow(1000, 4);
return (this.get('bytes') / Math.pow(1000, 4)).toFixed(2);
}),
pb: Ember.computed('bytes', function () {
return this.get('bytes') / Math.pow(1000, 5);
return (this.get('bytes') / Math.pow(1000, 5)).toFixed(2);
}),

bytesWithUnits: Ember.computed('bytes', function () {
Expand All @@ -39,7 +40,7 @@ export default Ember.Object.extend({
}),

humanReadable: Ember.computed('bytes', function () {
var sizes = ['bytes', 'kb', 'gb', 'tb', 'pb'];
var sizes = ['bytes', 'kb', 'mb', 'gb', 'tb', 'pb'];
var that = this;
var result;

Expand Down