filesize

Human-readable file size formatting library. Converts byte counts to human-readable strings: filesize(1000000) → '976.56 KiB' or '1 MB' depending on rounding options. Supports decimal (SI/kB) and binary (IEC/KiB) units, configurable precision, locale-aware number formatting, partial results for custom formatting, and exponent control. Used in file upload progress, storage statistics display, bandwidth monitoring, and any UI showing data sizes.

Evaluated Mar 06, 2026 (0d ago) v10.x
Homepage ↗ Repo ↗ Developer Tools filesize bytes formatting utilities node browser human-readable
⚙ Agent Friendliness
68
/ 100
Can an agent use this?
🔒 Security
99
/ 100
Is it safe for agents?
⚡ Reliability
92
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
88
Error Messages
82
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
100
Auth Strength
100
Scope Granularity
100
Dep. Hygiene
95
Secret Handling
100

Pure formatting utility — zero security surface.

⚡ Reliability

Uptime/SLA
98
Version Stability
90
Breaking Changes
85
Error Recovery
95
AF Security Reliability

Best When

You need to display byte counts in a human-friendly format in any JavaScript UI or logging output.

Avoid When

You need to parse human-readable sizes back to bytes (use bytes package), or need locale-specific formatting (filesize has some locale support).

Use Cases

  • Format file sizes for upload progress indicators: '2.5 MB of 10 MB uploaded'
  • Display storage usage in dashboards: filesize(usedBytes) + ' used of ' + filesize(totalBytes)
  • Format API response sizes in developer tools and monitoring dashboards
  • Show download sizes in file browsers or media libraries
  • Format bandwidth statistics in network monitoring UIs

Not For

  • Parsing human-readable sizes back to bytes — filesize formats only; use bytes or a custom parser for reverse conversion
  • Storage arithmetic — convert to bytes first for calculations, then format with filesize
  • Precise scientific display — filesize is for user-friendly display, not precise scientific notation

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

No authentication — formatting utility library.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

Fully free, BSD licensed.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • Default uses binary IEC units (KiB, MiB) not SI decimal (kB, MB) — users expecting SI kB/MB must use standard: 'si' option: filesize(bytes, { standard: 'si' })
  • filesize v10 is ESM-only — use filesize v9 for CommonJS compatibility, or pretty-bytes (also ESM-only) as alternative
  • Output is a string — cannot do arithmetic on result; convert to bytes first for calculations: const totalBytes = usedBytes + freeBytes; then format separately
  • Precision vs round options: precision controls significant figures, round controls decimal places — choose based on desired output format
  • Large numbers (>10^18): exabytes and petabytes are supported but verify your BigInt handling if passing JavaScript Number limits
  • Locale formatting: locale: true uses Intl.NumberFormat for locale-aware thousands separators — requires Intl support in target environment

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for filesize.

$99

Scores are editorial opinions as of 2026-03-06.

5208
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered