Skip to content

Add sp sample download - #8

Open
cfsmp3 wants to merge 1 commit into
CCExtractor:masterfrom
cfsmp3:feat/sample-download
Open

cfsmp3 wants to merge 1 commit into
CCExtractor:masterfrom
cfsmp3:feat/sample-download

Conversation

@cfsmp3

@cfsmp3 cfsmp3 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

The API serves signed storage URLs for a sample, its MediaInfo XML and its extra files, but the CLI could only show where a file lives, not fetch it.

sp sample download <id> streams the sample to a temporary name beside the destination and moves it into place only once it is complete and matches the sample's recorded SHA-256. A mismatch exits with code 11. The storage URL is fetched without the bearer token.

--media-info and --extra-file fetch the other two files; neither has a recorded digest, so both report verified=false. -d/--dest sets the destination, since -o already selects the output format.

The API has served signed storage URLs for a sample, its MediaInfo XML
and its extra files for a while, but the CLI could only show where a
file lives, not fetch it. Getting a sample meant the web UI or pasting
a URL into curl.

`sp sample download <id>` asks /samples/{id}/download for the URL and
streams the bytes to disk. The file is written to a temporary name
beside the destination and moved into place only once complete and
checked against the sample's recorded SHA-256, so an interrupted or
corrupt transfer never leaves something that looks like a real
sample. A mismatch gets its own exit code, 11.

The storage URL is fetched without the bearer token: it points at the
bucket, which has no business seeing the platform credential.

--media-info and --extra-file fetch the other two files through their
own routes. Neither has a recorded digest, so both report
verified=false. -d/--dest rather than -o, which already means the
output format one level up.
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