MCPcopy Index your code
hub / github.com/SnapDrop/snapdrop / _formatFileSize

Method _formatFileSize

client/scripts/ui.js:287–297  ·  view source on GitHub ↗
(bytes)

Source from the content-addressed store, hash-verified

285 }
286
287 _formatFileSize(bytes) {
288 if (bytes >= 1e9) {
289 return (Math.round(bytes / 1e8) / 10) + ' GB';
290 } else if (bytes >= 1e6) {
291 return (Math.round(bytes / 1e5) / 10) + ' MB';
292 } else if (bytes > 1000) {
293 return Math.round(bytes / 1000) + ' KB';
294 } else {
295 return bytes + ' Bytes';
296 }
297 }
298
299 hide() {
300 this.$el.querySelector('.preview').style.visibility = 'hidden';

Callers 1

_displayFileMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected