From e29deab2aad4b63c40c995253e5dc67c5d5f16f9 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Thu, 15 Mar 2012 09:22:25 +0100 Subject: .functions: Add `gurl` function for gzip-enabled `curl` Inspired by @bluesmoon: http://twitter.com/bluesmoon/status/179982379098710017 --- .functions | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.functions b/.functions index 5b7b8e3..97b0fca 100644 --- a/.functions +++ b/.functions @@ -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 -- cgit v1.2.3