"use strict";

var suffix = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'],
    stepSize = 1024;

module.exports = function (size) {
    var i = 0;

    while (size >= stepSize) {
        size /= stepSize;

        i += 1;
    }

    return Math.floor(size) + suffix[i];
};
