Spaces:
Configuration error
Configuration error
Download src/utils/format.js from UUUZCX/video-optimizer-bot: direct link, hf CLI and curl.
- Browser
- Download file 431 Bytes
-
https://huggingface.co/spaces/UUUZCX/video-optimizer-bot/resolve/main/src/utils/format.js
- Command line
-
hf download hf://spaces/UUUZCX/video-optimizer-bot/src/utils/format.js
-
curl -L -o format.js https://huggingface.co/spaces/UUUZCX/video-optimizer-bot/resolve/main/src/utils/format.js
431 Bytes
| function bytes(value) { | |
| const n = Number(value) || 0; | |
| const units = ["B", "KB", "MB", "GB", "TB"]; | |
| let size = n; | |
| let unit = 0; | |
| while (size >= 1024 && unit < units.length - 1) { | |
| size /= 1024; | |
| unit += 1; | |
| } | |
| return `${size.toFixed(unit === 0 ? 0 : 1)} ${units[unit]}`; | |
| } | |
| function percent(value) { | |
| return `${Math.max(0, Math.min(100, Math.round(Number(value) || 0)))}%`; | |
| } | |
| module.exports = { bytes, percent }; | |