MCPcopy
hub / github.com/vuejs/devtools-v6 / bytesToSize

Function bytesToSize

extension-zips.js:23–30  ·  view source on GitHub ↗
(bytes)

Source from the content-addressed store, hash-verified

21const SKIP_DIR_GLOBS = ['node_modules', 'src']
22
23function bytesToSize(bytes) {
24 const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']
25 if (bytes === 0) {
26 return '0 Byte'
27 }
28 const i = Number.parseInt(Math.floor(Math.log(bytes) / Math.log(1024)))
29 return `${Math.round(bytes / 1024 ** i, 2)} ${sizes[i]}`
30}
31
32(async () => {
33 await writeZip('devtools-chrome.zip', 'shell-chrome')

Callers 1

writeZipFunction · 0.85

Calls 1

logMethod · 0.80

Tested by

no test coverage detected