Measure compressed request size with curl, gzip and wc
To measure gzip sizing for a request, you don’t need to actually gzip it, just use pipe |
to pipe the stream from curl
to gzip
to wc
:
1 | # before gzip |
As you can see, before gzip it’s 57847 bytes, after gzip it’s 10443 bytes.
Measure file size after gzip
You could do same things to measure a file gzip sizing by gzip with -c
option, so it won’t actually gzip it.
1 | $ gzip -c foo.jpg | wc -c |