Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #21 from omersaeed/master

Minor change in gloss to get Tera Bytes and Peta Bytes in formats
  • Loading branch information...
commit 80e1761e1f7ca023f31754f1f8bb4ef7aa02e62d 2 parents bdb4ada + 039eb80
@aaronj1335 aaronj1335 authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/util/format.js
View
10 src/util/format.js
@@ -12,13 +12,15 @@ define([
10: options.units === 'short'? ' B' : ' Bytes',
20: options.units === 'short'? ' KB' : ' Kilobytes',
30: options.units === 'short'? ' MB' : ' Megabytes',
- 40: options.units === 'short'? ' GB' : ' Gigabytes'
+ 40: options.units === 'short'? ' GB' : ' Gigabytes',
+ 50: options.units === 'short'? ' TB' : ' Terabytes',
+ 60: options.units === 'short'? ' PB' : ' Petabytes'
};
for (i in units)
if (bytes < Math.pow(2, i))
return (bytes / Math.pow(2, i-10)).toFixed(1) + units[i];
- return (bytes / Math.pow(2, 30)).toFixed(1) + units[40];
+ return (bytes / Math.pow(2, 30)).toFixed(1) + units[60];
};
var inverse_bytes = function(s) {
@@ -30,6 +32,10 @@ define([
factor = 1000;
} else if (/gigabyte|gb/i.test(s)) {
factor = 1000000000;
+ } else if (/terabyte|tb/i.test(s)) {
+ factor = 1000000000000;
+ } else if (/petabyte|pb/i.test(s)) {
+ factor = 1000000000000000;
} else if (/b/i.test(s)) {
factor = 1;
} else {
Please sign in to comment.
Something went wrong with that request. Please try again.