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

Sponsored by
Next.js Weekly

Stay up to date on Next.js

A weekly newsletter to keep up with what's happening in the ecosystem.

Need software licensing?

Simple licensing for software, easily distribute your product.

  • - payment automation
  • - customer portal
  • - offline licensing