FYI, this project is listed as "retired." It may no longer function or I may
just not be updating it anymore.
A Service and a CLI conversion tool for file sizes.
Usage
You can use Bytes in a few ways.
First, just pass a number representing bytes to it. It will find the human-readable representation of it, ranging from Kilobytes to Yottabytes. Example:
This is the same as the “to human” argument, unless the number already has a size name in it (245mb), in which case it would just return the input. If you add “to machine” to a number like that, you’ll get the byte equivalent back:
The script works with STDIN pipes or command line arguments, the former making it better for use in a Service. It will also look for its recongized syntaxes surrounded by parentheses in a larger block of text, so you can use it just like SearchLink:
The file had a size of (24mb to machine), which converted to (25165824 to human) (that’s (24mb in kb) in Kilobytes).
Piped to bytes.rb, that becomes:
The file had a size of 25165824, which converted to 24.00MB (that’s 24576.00KB in Kilobytes).
I don’t know how many people will ever have a use for this, but I liked the regex enough that I figured I should share it1. Download the System Service below, or grab the command-line script on GitHub.
To use the script, just make it executable and put it in your path. To use the Service, unzip and double click it to install, then select text containing its syntax and right click.