Revision 198b546d snf-cyclades-app/synnefo/ui/static/snf/js/utils.js
b/snf-cyclades-app/synnefo/ui/static/snf/js/utils.js | ||
---|---|---|
1 |
// Copyright 2011 GRNET S.A. All rights reserved.
|
|
1 |
// Copyright 2014 GRNET S.A. All rights reserved.
|
|
2 | 2 |
// |
3 | 3 |
// Redistribution and use in source and binary forms, with or |
4 | 4 |
// without modification, are permitted provided that the following |
... | ... | |
237 | 237 |
} |
238 | 238 |
|
239 | 239 |
synnefo.util.readablizeBytes = function(bytes, fix) { |
240 |
if (parseInt(bytes) == 0) { return '0 bytes' } |
|
240 | 241 |
if (fix === undefined) { fix = 2; } |
241 | 242 |
var s = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB']; |
242 | 243 |
var e = Math.floor(Math.log(bytes)/Math.log(1024)); |
Also available in: Unified diff