MCPcopy Create free account
hub / github.com/TruthHun/BookStack / formatBytes

Function formatBytes

static/js/main.js:40–46  ·  view source on GitHub ↗
($size)

Source from the content-addressed store, hash-verified

38};
39
40function formatBytes($size) {
41 var $units = [" B", " KB", " MB", " GB", " TB"];
42
43 for ($i = 0; $size >= 1024 && $i < 4; $i++) $size /= 1024;
44
45 return $size.toFixed(2) + $units[$i];
46}
47
48//将json字符串解析成json对象
49function parseJson(obj) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected