Function: nerd-icons-ibuffer--file-size-human-readable-to-bytes
nerd-icons-ibuffer--file-size-human-readable-to-bytes is a natively
compiled function defined in nerd-icons-ibuffer.el.
Signature
(nerd-icons-ibuffer--file-size-human-readable-to-bytes FILE-SIZE &optional FLAVOR)
Documentation
Convert a human-readable FILE-SIZE string into bytes with FLAVOR.
Source Code
;; Defined in /nix/store/ak43hmgddynw3xxp0dnf5nkc3pp5yrbr-emacs-packages-deps/share/emacs/site-lisp/elpa/nerd-icons-ibuffer-20251022.42/nerd-icons-ibuffer.el
(defun nerd-icons-ibuffer--file-size-human-readable-to-bytes (file-size &optional flavor)
"Convert a human-readable FILE-SIZE string into bytes with FLAVOR."
(let ((power (if (or (null flavor) (eq flavor 'iec))
1024.0
1000.0))
(prefixes '("k" "M" "G" "T" "P" "E" "Z" "Y"))
(iterator 0))
(catch 'bytes
(while
(cond
((equal iterator 8)
(throw 'bytes (* (string-to-number file-size) (expt power 0))))
((string-match (elt prefixes iterator) file-size)
(throw 'bytes (* (string-to-number file-size) (expt power (1+ iterator)))))
(t
(setq iterator (1+ iterator))))))))