MCPcopy Create free account
hub / github.com/acode/cli / formatSize

Function formatSize

cli/tar.js:10–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8const tar = require('tar-stream');
9
10const formatSize = size => {
11 let sizes = [[2, 'M'], [1, 'k']];
12 while (sizes.length) {
13 let checkSize = sizes.shift();
14 let limit = Math.pow(1024, checkSize[0]);
15 if (size > limit) {
16 return `${(size / limit).toFixed(2)} ${checkSize[1]}B`
17 }
18 }
19 return `${size} B`;
20};
21
22function readFiles (base, properties, dir, data) {
23

Callers 1

tar.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected