Skip to content

Commit 83b6995

Browse files
authored
feat: use IEC binary size prefixes (#2483)
* Added binary (IEC) prefixes * Added missing binary prefixes
1 parent db8145c commit 83b6995

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lua/nvim-tree/utils.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ function M.move_missing_val(src, src_path, src_pos, dst, dst_path, dst_pos, remo
281281
end
282282

283283
function M.format_bytes(bytes)
284-
local units = { "B", "K", "M", "G", "T" }
284+
local units = { "B", "K", "M", "G", "T", "P", "E", "Z", "Y" }
285285

286286
bytes = math.max(bytes, 0)
287287
local pow = math.floor((bytes and math.log(bytes) or 0) / math.log(1024))
@@ -292,7 +292,7 @@ function M.format_bytes(bytes)
292292

293293
pow = pow + 1
294294

295-
return (units[pow] == nil) and (bytes .. "B") or (value .. units[pow])
295+
return (units[pow] == nil) and (bytes .. units[1]) or (value .. units[pow] .. "i" .. units[1])
296296
end
297297

298298
function M.key_by(tbl, key)

0 commit comments

Comments
 (0)