getFileSize()

in source/frontend/src/app/pages/sftp-main/sftp-main.component.ts [273:279]


  getFileSize(size){
    var sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
    var bytes = size*1024;
    if (bytes == 0) return '0 B';
    var i = Math.floor(Math.log(bytes) / Math.log(1024));
    return Math.round(bytes / Math.pow(1024, i)) + ' ' + sizes[i];
  }