File
File sizes people can read in the locale number format, and downloads of a URL or a Blob from code.
Part of @tectra-ng/utils (npm install @tectra-ng/utils, also included in tectra-ng).
File size
txFileSize picks the unit; base: 1000 for disk-maker kilobytes, decimals for precision. No size shows -.
| notes.txt | 812 B | 812 B |
| logo.svg | 14 KB | 14.34 KB |
| report.pdf | 2.5 MB | 2.62 MB |
| backup.zip | 4.5 GB | 4.83 GB |
| upload.tmp | - | - |
Download
downloadBlob saves data made in the browser — here a CSV of the table — and frees its object URL.