File Size to String in JavaScript
Recently, I needed to figure out a way to convert the size of a file, which is being returned in bytes, to a string representation. So, given a file size in bytes like 349792 the string “342KB” would be returned. Inspired by the following StackOverflow post, I came up with this JavaScript version. function fileSizeToString(size) … [Read more…]