mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-14 04:08:28 +00:00
12 lines
471 B
JavaScript
12 lines
471 B
JavaScript
module.exports = function prettyBytes(bytes) {
|
|
if (typeof bytes !== "number") {
|
|
throw new TypeError("Expected a number")
|
|
}
|
|
|
|
// Simple mock implementation that returns formatted strings.
|
|
if (bytes === 0) return "0 B"
|
|
if (bytes < 1024) return `${bytes} B`
|
|
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`
|
|
if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`
|
|
return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`
|
|
}
|