diff options
author | Mathias Bynens <mathias@qiwi.be> | 2012-03-15 09:22:25 +0100 |
---|---|---|
committer | Mathias Bynens <mathias@qiwi.be> | 2012-03-15 09:22:25 +0100 |
commit | e29deab2aad4b63c40c995253e5dc67c5d5f16f9 (patch) | |
tree | d8cbbd8ff746bee31f434c73ca6e563b51df5032 /.functions | |
parent | 1de8cb8476bbf2cd71fa1e83126b057e38850705 (diff) | |
download | dotfiles-e29deab2aad4b63c40c995253e5dc67c5d5f16f9.tar.gz dotfiles-e29deab2aad4b63c40c995253e5dc67c5d5f16f9.tar.bz2 dotfiles-e29deab2aad4b63c40c995253e5dc67c5d5f16f9.zip |
.functions: Add `gurl` function for gzip-enabled `curl`
Inspired by @bluesmoon: http://twitter.com/bluesmoon/status/179982379098710017
Diffstat (limited to '.functions')
-rw-r--r-- | .functions | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -18,6 +18,11 @@ function httpcompression() { encoding="$(curl -LIs -H 'User-Agent: Mozilla/5 Gecko' -H 'Accept-Encoding: gzip,deflate,compress,sdch' "$1" | grep '^Content-Encoding:')" && echo "$1 is encoded using ${encoding#* }" || echo "$1 is not using any encoding" } +# Gzip-enabled `curl` +function gurl() { + curl -sH "Accept-Encoding: gzip" "$@" | gunzip +} + # Syntax-highlight JSON strings or files function json() { if [ -p /dev/stdin ]; then |