From a9942ac635f1f55c2c585e9d256419a48c2ba5ee Mon Sep 17 00:00:00 2001 From: Paul Irish Date: Thu, 31 May 2012 20:09:28 +0200 Subject: .functions: Add `gz` function to get gzipped file size --- .functions | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.functions b/.functions index b9ec9dd..1754c93 100644 --- a/.functions +++ b/.functions @@ -25,6 +25,14 @@ function server() { python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port" } +# Get gzipped file size +function gz() { + echo "orig size (bytes): " + cat "$1" | wc -c + echo "gzipped size (bytes): " + gzip -c "$1" | wc -c +} + # Test if HTTP compression (RFC 2616 + SDCH) is enabled for a given URL. # Send a fake UA string for sites that sniff it instead of using the Accept-Encoding header. (Looking at you, ajax.googleapis.com!) function httpcompression() { -- cgit v1.2.3