Skip to content

Instantly share code, notes, and snippets.

@loopmode
Created November 18, 2021 20:40
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 loopmode/bdab45daa5ef19d6c1af7ce9f81a6f5f to your computer and use it in GitHub Desktop.
Save loopmode/bdab45daa5ef19d6c1af7ce9f81a6f5f to your computer and use it in GitHub Desktop.
display gzipped size of files
# put this in your ~/.bashrc
gzipped() {
if [ -z $1 ]; then
echo "No file specified"
else
b=$(gzip -c $1 | wc -c)
echo "$b B"
KB=$(awk "BEGIN {printf \"%.2f\n\", $b/1024}")
echo "$KB KB"
MB=$(awk "BEGIN {printf \"%.2f\n\", $b/1024/1024}")
echo "$MB MB"
fi
}
$ gzipped ./zxcvbn.js
398447 B
389.11 KB
0.38 MB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment