If you want to know what is the size of an HTTP/HTTPS request response-payload, you need to look at the content-length header from the response headers.
Example:% curl -sI "https://code.jquery.com/jquery-3.5.0.min.js"
HTTP/2 200
date: Wed, 30 Nov 2022 12:02:51 GMT
content-length: 89493
content-type: application/javascript; charset=utf-8
last-modified: Fri, 20 Aug 2021 17:47:53 GMT
accept-ranges: bytes
server: nginx
etag: W/"611feac9-15d95"
cache-control: max-age=315360000
cache-control: public
access-control-allow-origin: *
vary: Accept-Encoding
x-hw: 1669809771.dop244.fr8.t,1669809771.cds237.fr8.hn,1669809771.cds139.fr8.c
You can pipe it with grep command to just get the size of the response in bytes.
Exmple:% curl -sI "https://code.jquery.com/jquery-3.5.0.min.js" | grep content-length
content-length: 89493
Note: The way Content-Lenght is displayed in the HTTP response may differ in upper-lowercase, so it's better to make use of case-insensitivity options with grep.
% curl -sI "https://code.jquery.com/jquery-3.5.0.min.js" | grep -iF 'content-length'
content-length: 89493

-
Have Questions? Post them here!
More Posts related to cURL,
- How to set Connection and Max Timeout for cURL Request with Examples
- cURL Option to show HTTP Response Status Code
- [fix] command not found curl
- Perform Basic Authentication using cURL with Examples
- Hide cURL Outputs and Errors on Terminal
- cURL Example using IP (IPv4 and IPv6) address and Port
- List of 28 Protocols supported by cURL with Examples
- Save cURL Command Output to a external file
- Get cURL command from Chrome Inspect Network HTTP URL
- URL Encode cURL HTTP GET\POST Data with Examples
- Efficient way to perform HTTP cURL GET/POST Requests with Payload
- Trace using cURL Command Example
- Get the Size of HTTP Response using cURL Command (Content Length)
- Fetch only content-type using cURL Command
- How to get cURL Command to run in verbose mode?
More Posts:
- Program 9: Divide Two Numbers - 1000+ Python Programs - Python-Programs
- How to clear ZSH history of commands executed on Mac Terminal - zsh
- Whats new in Python 3.10 Pre-release - Python
- [Solution] Installing Whatsapp There's insufficient space on the device - WhatsApp
- Loading previous page using html button using JavaScript - JavaScript
- Java equals method - Tutorial - Java
- Sort ls command by last modified date and time - Linux
- Docker Alpine Linux and Apache2 Example - Docker