MCPcopy
hub / github.com/apache/echarts / convertBytes

Function convertBytes

test/runTest/store.js:40–47  ·  view source on GitHub ↗
(bytes)

Source from the content-addressed store, hash-verified

38const TEST_HASH_SPLITTER = '__';
39
40function convertBytes(bytes) {
41 const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB']
42 if (bytes == 0) {
43 return 'N/A';
44 }
45 const i = Math.floor(Math.log(bytes) / Math.log(1024));
46 return (bytes / Math.pow(1024, i)).toFixed(Math.min(1, i)) + ' ' + sizes[i]
47}
48class Test {
49 constructor(fileUrl) {
50 this.fileUrl = fileUrl;

Callers 1

store.jsFile · 0.85

Calls 1

toFixedMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…