There are plenty of answers to this question for Java (How to convert byte size into human readable format in java?, and Format file size as MB, GB etc) and even for Groovy/Grails, not to mention PHP, but is there a built-in or convenient way to do this in FreeMarker?
For clarity, I'm after the generic SI method in common parlance, rather than Binary powers of 2. E.g.
1 ➤ 1B
123 ➤ 123B
1000 ➤ 1KB
1728 ➤ 1.7KB
7077888 ➤ 7.1MB
And so on.
Given that FreeMarker doesn't appear to have a logarithm function, is there a way to do this in pure FreeMarker, or is my only option to create a Template Method with Java.