Coding Hell

Programming and stuff.

Extended Usage of HumanReadableFileSize.js

I just extended my jQuery plugin HumanReadableFileSize.js to support replacing the (numerical) contents of elements with a human-readable file size. Here is an example of how it works:

1
2
3
4
5
<span class="filesize">54788455578</span> <!-- 51.03 GiB -->
<span class="filesize">2322</span> <!-- 2.27 KiB -->
<script type="text/javascript">
  $('.filesize').fileSize(2, true);
</script>

Hope it’s of some use to you.

Comments