Skip to content

Instantly share code, notes, and snippets.

@caseycrites
Created February 13, 2012 22:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caseycrites/1821077 to your computer and use it in GitHub Desktop.
Save caseycrites/1821077 to your computer and use it in GitHub Desktop.
if (fileSize < 1024) {
response = parseFloat(fileSize).toFixed(2) + " bytes"
} else if (fileSize < 1048576) {
response = (parseFloat(fileSize)/1024).toFixed(2) + " KB"
} else {
response = (parseFloat(fileSize)/1048576).toFixed(2) + " MB"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment