Handlebars.registerHelper('filesize', function(size) {
	var u = 0, s = 1024;

    while (size >= s || -size >= s) {
        size /= s;
        u++;
    }

    return (u ? size.toFixed(0) + ' ' : size) + ' KMGTPEZY'[u] + 'B';
});
