import BadDataException from "./Exception/BadDataException";
export default class DiskSize {
    static convertToDecimalPlaces(value, decimalPlaces = 2) {
        if (decimalPlaces < 0) {
            throw new BadDataException("decimalPlaces must be greater than or equal to 0.");
        }
        if (typeof value === "string") {
            value = parseFloat(value);
        }
        if (decimalPlaces === 0) {
            return Math.ceil(value);
        }
        value = value * Math.pow(10, decimalPlaces);
        // convert to int.
        value = Math.round(value);
        // convert back to float.
        value = value / Math.pow(10, decimalPlaces);
        return value;
    }
    static byteSizeToGB(byteSize) {
        return byteSize / 1024 / 1024 / 1024;
    }
    static byteSizeToMB(byteSize) {
        return byteSize / 1024 / 1024;
    }
    static byteSizeToKB(byteSize) {
        return byteSize / 1024;
    }
}
//# sourceMappingURL=DiskSize.js.map