﻿/**
 * HaiKom JavaScripts file.
 */

// Returns the size string of the specified size in bytes.
function toSizeString(bytes) {
	var si_prefices = ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
	var prefix = 0;
	while (bytes > 1000) {
		bytes /= 1000;
		prefix++;
	}
	return bytes.toFixed(2) + ' ' + si_prefices[prefix] + 'B';
}

