Add a download command for saving channel files locally#26
Open
closestfriend wants to merge 1 commit into
Open
Add a download command for saving channel files locally#26closestfriend wants to merge 1 commit into
closestfriend wants to merge 1 commit into
Conversation
Adds `arena download <slug> [dir]` to pull a channel's images and
attachments to disk — the inverse of the existing upload/import commands.
Works with private channels, since the listing goes through the
authenticated API client.
- Paginates /v3/channels/{id}/contents, resolving each block to a target:
Images (with --size), Attachments, and Text (opt-in via --include-text).
- Streams assets concurrently (--concurrency) with retry/backoff, and
sends a User-Agent so Are.na's CDN doesn't return empty bodies.
- Always writes a manifest.json so Link/Embed/Text metadata is preserved.
- Skips existing files unless --overwrite; supports --type filtering.
Logic lives in src/lib/download.ts behind an injectable adapter (mirroring
import.ts), with unit tests covering pagination, target resolution,
failures, retries, skipping, and type filters.
dzucconi
reviewed
Jun 17, 2026
Member
There was a problem hiding this comment.
Looks like this file has a literal NUL byte in a regex, which makes Github classify it as a binary file. Makes it hard to review. Could escape it as a range like [\x00-\x1F]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The CLI can push files into Are.na (
upload,import) but there's no way to pull them back out — you can list a channel's contents, but not save the actual images and attachments to disk. This addsarena download <slug> [dir]to close that gap.Works on any channel you can access — your own private channels (via
arena login) and any public channel — which makes it a building block toward #22 (backup functionality).What it does
/v3/channels/{id}/contentsand resolves each block to a download target: Images (with--size original|large|medium|small|square), Attachments, and Text (opt-in via--include-text).--concurrency, default 4) with retry/backoff on transient errors.manifest.jsonso Link/Embed/Text metadata (titles, source URLs) is preserved even though those have no hosted file.--overwrite;--typefilters to one block type.--json(NDJSON progress stream) for scripting, consistent withimport.One thing worth flagging
Are.na's CloudFront CDN returns
202 Acceptedwith an empty body when a request has noUser-Agent, which silently produces 0-byte files. The command sends an explicitUser-Agentto avoid that.Design
Logic lives in
src/lib/download.tsbehind an injectable adapter, mirroringimport.ts. Unit tests (src/lib/download.test.ts) cover pagination, per-type target resolution,--size, filename fallbacks, failures + exit codes, transient retries, skip-existing, and--typefiltering.Tested
arena login): authenticated listing → all images downloaded, links preserved in the manifest.npm run checkgreen (typecheck + 86 tests + build).Scope
This is per-channel download, not the full automated whole-account backup #22 describes — but it's the core primitive that makes that possible.