Skip to content

feat: add download, cat, and ls commands#48

Merged
pcfreak30 merged 2 commits into
developfrom
feat/download-command
May 18, 2026
Merged

feat: add download, cat, and ls commands#48
pcfreak30 merged 2 commits into
developfrom
feat/download-command

Conversation

@pcfreak30
Copy link
Copy Markdown
Member

@pcfreak30 pcfreak30 commented May 18, 2026

Three new commands for accessing pinned IPFS content:

  • pinner download [/] — save content to disk
  • pinner cat [/] — stream content to stdout
  • pinner ls [/] — list directory contents

Supports CID paths for accessing nested content (e.g. CID/subdir/file).
Listing a file shows metadata instead of erroring. JSON output uses
structs with proper tags — single object per command, lowercase keys.


This PR adds three new CLI commands for interacting with pinned IPFS content: download, cat, and ls.

New Commands:

  • download – Downloads pinned content from IPFS to a local file. Supports CID paths (e.g., CID/path/to/file) to download specific files from a directory. Includes --output/-o to specify the output path, --force to overwrite existing files, and --dry-run to preview the operation. Displays CID, local path, file size, gateway URL, and download duration.

  • cat – Streams IPFS content directly to stdout. Supports CID paths for streaming specific files from a directory. Useful for piping content to other commands (e.g., pinner cat QmHash | jq .).

  • ls – Lists the contents of an IPFS directory, showing file names, types (file/directory), and sizes. Supports --limit to cap the number of entries. If the path targets a file rather than a directory, it gracefully shows the file's metadata instead of erroring.

Supporting changes:

  • Added DownloadService interface and default implementation with methods for downloading, streaming, listing directories, and checking file sizes, backed by the ipfs-sdk package
  • Added IPFS path parsing (CID + optional subpath) and authentication handling including automatic JWT exchange for API keys
  • Added ErrDownloadFailed error type and registered DownloadService in the mockery configuration
  • Updated root command to register the new commands and updated their help text
  • Added comprehensive unit tests for all three command handlers and the service factory

Three new commands for accessing pinned IPFS content:

- pinner download <cid>[/<path>] — save content to disk
- pinner cat <cid>[/<path>] — stream content to stdout
- pinner ls <cid>[/<path>] — list directory contents

Supports CID paths for accessing nested content (e.g. CID/subdir/file).
Listing a file shows metadata instead of erroring. JSON output uses
structs with proper tags — single object per command, lowercase keys.
@kody-ai

This comment has been minimized.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

Code Coverage Report

Total Coverage: 34.6%

Generated from commit: 3d97fcf
Repository: LumeWeb/pinner-cli

Comment thread pkg/cli/download_client.go
@kody-ai
Copy link
Copy Markdown

kody-ai Bot commented May 18, 2026

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug
Performance
Security
Business Logic

Access your configuration settings here.

@pcfreak30 pcfreak30 merged commit 883c092 into develop May 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant