how to convert file size in KB/GB

May be file_name.size.kilobytes ?

here's another one http://blog.snowonrails.com/articles/2007/05/14/ruby中的kernel-sprintf-ruby中实现保留小数点后若干位小数的方法