fetch-cli-0.3.0 is not a library.
fetch
fetch is a modern HTTP(S) client for the command line.
Its features include:
- auto formatted and colored output for supported types (e.g. json, xml, etc.)
- render images directly in your terminal
- easily sign requests with AWS Signature V4
- optionally use an editor to define the request body
- progress bar for file downloads
- automatic response body decompression for gzip, deflate, brotli, and zstd
- and more!
Install
Download binary
Download the binary for your os and architecture here.
Install with cargo
Building from source
Clone this repository:
Then build with Cargo:
Usage
Basic usage
# Make a simple GET request
# fetch will default to using HTTPS if no scheme is specified
# Make a PUT request with inline body
# Make a PUT request with inline JSON body
# The --json flag will set the content-type header to 'application/json'
# Send a request body from a local file
# The content-type will automatically be inferred from the file extension
# Use an editor to define the JSON request body
Verbosity
# By default, fetch will write the HTTP version and status to stderr.
# HTTP/1.1 200 OK
#
# [response data]
# Providing the verbose flag a single time will also output the response headers
# HTTP/1.1 200 OK
# date: Sat, 05 Oct 2024 04:42:51 GMT
# content-type: application/json; charset=utf-8
# content-length: 456
#
# [response data]
# Providing the verbose flag twice will also output the request headers
# GET / HTTP/1.1
# host: example.com
# accept: */*
# accept-encoding: gzip, deflate, br, zstd
# user-agent: fetch/0.1.0
#
# HTTP/1.1 200 OK
# date: Sat, 05 Oct 2024 04:42:51 GMT
# content-type: application/json; charset=utf-8
# content-length: 456
#
# [response data]
# If you don't want any metadata written to stderr, use the silent flag
# [response data]
Headers
# Set a custom request header for the request in the 'key:value' format
# Set multiple request headers
Query parameters
# Append a query parameter to the request in the 'key=value' format
# Parameters will be appended to any exist query parameters on the request
Send a request with a form body
# Send a POST request with a form body.
# Sets the content-type to 'application/x-www-form-urlencoded'
Write the response body to a file
# Write the response body to a local file
# Write the response body to a file, disabling the progress bar
AWS signature v4
# Sign a request with aws signature v4.
# This will set the authorization, x-amz-date, and optionally the x-amz-content-sha256 headers
Images
Images will be automatically rendered in your terminal.
High quality images will be rendered in the following terminals:
- ghostty
- kitty
- wezterm
- iterm2
- mintty
- konsole
Low quality block-based images will be rendered in all other terminal emulators.
Supported image types are:
- jpeg
- png
- webp
- tiff