Download a File With Headers Preserved
Save raw bytes while capturing verbose headers separately.
When you save a response to a file, stdout should contain only the body bytes. Verbose diagnostics are written to stderr, so you can redirect them to a separate file without corrupting the download.
restish -v api.rest.sh/images/jpeg > dragonfly.jpg 2> dragonfly.headers.txt
The body goes to stdout and verbose metadata goes to stderr, so the saved file stays clean. Unfiltered responses redirect as body bytes by default; see Output Defaults for how redirects choose between body bytes and formatted values.
Related: Command Behavior, Output.