From 35e25be1a404035d2faf710f9c84baf39a3573d8 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Wed, 29 Jul 2015 19:15:38 -0600 Subject: [PATCH] browse: Size displayed in IEC format Powers of 2, or base 1024, rather than powers of 10 or base 1000. The powers of 2 are technically more accurate. --- middleware/browse/browse.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/middleware/browse/browse.go b/middleware/browse/browse.go index 756ca8c83..6868be881 100644 --- a/middleware/browse/browse.go +++ b/middleware/browse/browse.go @@ -120,9 +120,10 @@ func (l Listing) applySort() { } } -// HumanSize returns the size of the file as a human-readable string. +// HumanSize returns the size of the file as a human-readable string +// in IEC format (i.e. power of 2 or base 1024). func (fi FileInfo) HumanSize() string { - return humanize.Bytes(uint64(fi.Size)) + return humanize.IBytes(uint64(fi.Size)) } // HumanModTime returns the modified time of the file as a human-readable string.