Last active
February 16, 2026 02:22
-
Star
(205)
You must be signed in to star a gist -
Fork
(34)
You must be signed in to fork a gist
-
-
Save thomseddon/3511330 to your computer and use it in GitHub Desktop.
Revisions
-
thomseddon revised this gist
Apr 3, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,6 @@ app.filter('bytes', function() { if (typeof precision === 'undefined') precision = 1; var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'], number = Math.floor(Math.log(bytes) / Math.log(1024)); return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number]; } }); -
thomseddon created this gist
Aug 29, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ app.filter('bytes', function() { return function(bytes, precision) { if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-'; if (typeof precision === 'undefined') precision = 1; var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'], number = Math.floor(Math.log(bytes) / Math.log(1024)); return (bytes/Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number]; } });