decord/source/utils/FileSizeUtils.tsx

96 lines
2.8 KiB
TypeScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 4026
2026-07-27 11:26:19 +00:00
// Function ID: 33521
2026-07-20 16:05:17 +00:00
// Name: formatSize
2026-07-23 10:11:24 +00:00
// Dependencies: [1212, 2]
2026-07-20 16:05:17 +00:00
// Exports: formatKbSize
2026-07-25 08:10:48 +00:00
// Module 4026 (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-23 10:11:24 +00:00
const intl2 = require(1212) /* getSystemLocale */.intl;
2026-07-20 16:05:17 +00:00
const formatToPlainString2 = intl2.formatToPlainString;
2026-07-23 10:11:24 +00:00
const t2 = require(1212) /* getSystemLocale */.t;
2026-07-20 16:05:17 +00:00
if (tmp.useSpace) {
let obj = { size: rounded };
let formatToPlainString2Result = formatToPlainString2(t2.cS889N, obj);
} else {
obj = { size: rounded };
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-23 10:11:24 +00:00
const intl = require(1212) /* getSystemLocale */.intl;
2026-07-20 16:05:17 +00:00
const formatToPlainString = intl.formatToPlainString;
2026-07-23 10:11:24 +00:00
const t = require(1212) /* getSystemLocale */.t;
2026-07-20 16:05:17 +00:00
if (tmp.useSpace) {
const obj1 = { size: result1 };
let formatToPlainStringResult = formatToPlainString(t.yhEXX7, obj1);
} else {
obj = { size: result1 };
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
}
if (result / num >= 1) {
let formatToPlainStringResult = formatSize(result, tmp);
} else {
2026-07-23 10:11:24 +00:00
const intl = require(1212) /* getSystemLocale */.intl;
2026-07-20 16:05:17 +00:00
const formatToPlainString = intl.formatToPlainString;
2026-07-23 10:11:24 +00:00
const t = require(1212) /* getSystemLocale */.t;
2026-07-20 16:05:17 +00:00
if (tmp.useSpace) {
let obj = {};
const _Math2 = Math;
obj.size = Math.ceil(result);
formatToPlainStringResult = formatToPlainString(t.bTzRR6, obj);
} else {
obj = {};
const _Math = Math;
obj.size = Math.ceil(result);
formatToPlainStringResult = formatToPlainString(t.kEk9pr, obj);
}
}
return formatToPlainStringResult;
};