ComponentsUtilities

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).

Features2APIThemingAccessibility

File size

txFileSize picks the unit; base: 1000 for disk-maker kilobytes, decimals for precision. No size shows -.

notes.txt 812 B812 B
logo.svg 14 KB14.34 KB
report.pdf 2.5 MB2.62 MB
backup.zip 4.5 GB4.83 GB
upload.tmp --

Download

downloadBlob saves data made in the browser — here a CSV of the table — and frees its object URL.