Better Upload

Helpers

A collection of helper functions and utilities for your project.

Format bytes

Format a number of bytes into a human-readable string.

import { formatBytes } from 'better-upload/client/helpers';

formatBytes(1000); // "1 kB"
formatBytes(1000, { decimalPlaces: 2 }); // "1.00 kB"

formatBytes(1024, { si: false }); // "1 KiB"
formatBytes(1024, { decimalPlaces: 2, si: false }); // "1.00 KiB"

On this page