Skip to content

Add --output / -o flag to save response body to file #15

@kavix

Description

@kavix

Description

Users currently pipe output to files, but this captures formatted/colored output rather than raw response. A dedicated flag should save the raw body.

Proposed Implementation

kurl https://api.example.com/image.png -o image.png
kurl https://api.example.com/data.json -o ./data.json --no-color

Why this matters

Piping formatted JSON with color codes to a file corrupts the data. A dedicated flag ensures raw binary/text output.

Acceptance Criteria

  • Add -o / --output flag
  • Save raw response body (not formatted/colored)
  • Create parent directories if they don't exist
  • Show download progress for large files (optional)
  • Add test coverage

Getting Started

Intercept the response body before formatting. Write to io.Writer that either goes to stdout or the file based on flag.


Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions