MCPcopy Create free account
hub / github.com/TributePaulWalker/Profiles / bytesToSize

Function bytesToSize

JavaScript/Surge/Sub_info_lite.js:123–129  ·  view source on GitHub ↗
(bytes)

Source from the content-addressed store, hash-verified

121}
122
123function bytesToSize(bytes) {
124 if (bytes === 0) return "0B";
125 let k = 1024;
126 sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
127 let i = Math.floor(Math.log(bytes) / Math.log(k));
128 return (bytes / Math.pow(k, i)).toFixed(2) + " " + sizes[i];
129}
130
131function formatTime(time) {
132 let dateObj = new Date(time);

Callers 1

Sub_info_lite.jsFile · 0.85

Calls 1

logMethod · 0.45

Tested by

no test coverage detected