decord/source/utils/FileSizeUtils.tsx

100 lines
2.9 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 4150
// Function ID: 4151
2026-07-20 16:05:17 +00:00
// Name: formatSize
2026-07-29 08:29:29 +00:00
// Dependencies: [1236, 2]
2026-07-20 16:05:17 +00:00
// Exports: formatKbSize
2026-08-05 07:35:12 +00:00
// Module 4150 (formatSize)
2026-07-20 16:05:17 +00:00
function formatSize(result, arg1) {
let tmp = arg1;
if (arg1 === undefined) {
tmp = closure_3;
}
let num = 1000;
let num2 = 1000;
if (tmp.useKibibytes) {
2026-07-23 10:11:24 +00:00
num2 = c2;
2026-07-20 16:05:17 +00:00
}
if (tmp.useKibibytes) {
num = 1024;
}
const rounded = Math.ceil(result / num2);
if (rounded < num) {
2026-07-29 08:29:29 +00:00
const intl2 = require(1236) /* getSystemLocale */.intl;
2026-07-20 16:05:17 +00:00
const formatToPlainString2 = intl2.formatToPlainString;
2026-07-29 08:29:29 +00:00
const t2 = require(1236) /* getSystemLocale */.t;
2026-07-20 16:05:17 +00:00
if (tmp.useSpace) {
2026-07-29 08:29:29 +00:00
let obj = { size: null };
obj[0] = rounded;
2026-07-20 16:05:17 +00:00
let formatToPlainString2Result = formatToPlainString2(t2.cS889N, obj);
} else {
2026-07-29 08:29:29 +00:00
obj = { size: null };
obj[0] = rounded;
2026-07-20 16:05:17 +00:00
formatToPlainString2Result = formatToPlainString2(t2.pIn7Af, obj);
}
return formatToPlainString2Result;
} else {
result = rounded / num;
const _Math = Math;
if (tmp.showDecimalForGB) {
let result1 = round(10 * result) / 10;
} else {
result1 = round(result);
}
2026-07-29 08:29:29 +00:00
const intl = require(1236) /* getSystemLocale */.intl;
2026-07-20 16:05:17 +00:00
const formatToPlainString = intl.formatToPlainString;
2026-07-29 08:29:29 +00:00
const t = require(1236) /* getSystemLocale */.t;
2026-07-20 16:05:17 +00:00
if (tmp.useSpace) {
2026-07-29 08:29:29 +00:00
const obj1 = { size: null };
obj1[0] = result1;
2026-07-20 16:05:17 +00:00
let formatToPlainStringResult = formatToPlainString(t.yhEXX7, obj1);
} else {
2026-07-29 08:29:29 +00:00
obj = { size: null };
obj[0] = result1;
2026-07-20 16:05:17 +00:00
formatToPlainStringResult = formatToPlainString(t.TbMX9D, obj);
}
return formatToPlainStringResult;
}
}
2026-07-23 10:11:24 +00:00
let c2 = 1024;
let closure_3 = { useKibibytes: false, showDecimalForGB: true, useSpace: true };
let result = require("set").fileFinishedImporting("utils/FileSizeUtils.tsx");
2026-07-20 16:05:17 +00:00
export const BYTE_IN_KB = 1024;
export const KB_IN_MB = 1024;
export { formatSize };
export const formatKbSize = function formatKbSize(MAX_STICKER_FILE_SIZE, arg1) {
let tmp = arg1;
if (arg1 === undefined) {
tmp = closure_3;
}
let num = 1000;
let num2 = 1000;
if (tmp.useKibibytes) {
num2 = 1024;
}
const result = MAX_STICKER_FILE_SIZE / num2;
if (tmp.useKibibytes) {
2026-07-23 10:11:24 +00:00
num = c2;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (1 <= result / num) {
2026-07-20 16:05:17 +00:00
let formatToPlainStringResult = formatSize(result, tmp);
} else {
2026-07-29 08:29:29 +00:00
const intl = require(1236) /* getSystemLocale */.intl;
2026-07-20 16:05:17 +00:00
const formatToPlainString = intl.formatToPlainString;
2026-07-29 08:29:29 +00:00
const t = require(1236) /* getSystemLocale */.t;
2026-07-20 16:05:17 +00:00
if (tmp.useSpace) {
2026-07-29 08:29:29 +00:00
let obj = { size: null };
2026-07-20 16:05:17 +00:00
const _Math2 = Math;
2026-07-29 08:29:29 +00:00
obj[0] = Math.ceil(result);
2026-07-20 16:05:17 +00:00
formatToPlainStringResult = formatToPlainString(t.bTzRR6, obj);
} else {
2026-07-29 08:29:29 +00:00
obj = { size: null };
2026-07-20 16:05:17 +00:00
const _Math = Math;
2026-07-29 08:29:29 +00:00
obj[0] = Math.ceil(result);
2026-07-20 16:05:17 +00:00
formatToPlainStringResult = formatToPlainString(t.kEk9pr, obj);
}
}
return formatToPlainStringResult;
};