rubyforgood / rubyforgood/skillrx-beacon
File Download Service
Open
Nobody has claimed this yet.
cross-app sync
- Dominant language
- HTML
- Stars
- 4
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
GET /api/v1/files/{id} with resume support
- Create FileDownloader service:
class FileDownloader
def download(file_id, expected_checksum:, resume_from: 0)
# Downloads to temp file
# Supports Range header for resume
# Returns path to downloaded file
end
end
- Download to temp directory (tmp/downloads/)
- Track partial download progress for resume capability
- Return downloaded file path for attachment
Verify downloaded files match manifest checksums
- Create ChecksumVerifier service:
class ChecksumVerifier
def verify!(file_path, expected_sha256)
actual = Digest::SHA256.file(file_path).hexdigest
expected = expected_sha256.delete_prefix("sha256:")
raise ChecksumMismatchError unless actual == expected
end
end
- Consider using MD5 since active storage uses MD5 for checksums
- Integrate verification before ActiveStorage attachment
- On mismatch: delete file, retry download (up to 3 attempts)
Ensure proper ActiveStorage setup for offline operation
- Verify config/storage.yml uses local disk:
local:
service: Disk
root: <%= Rails.root.join("storage") %> - Set in config/environments/production.rb:
config.active_storage.service = :local - Configure blob cleanup: old blobs purged when TopicFile destroyed
- Add storage/ to backup strategy
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading config/storage.yml and config/environments/production.rb, then locate the FileDownloader, ChecksumVerifier, ActiveStorage attachment flow, and TopicFile model. Done means downloads resume from partial files, checksum failures clean up and retry, local storage is configured for offline use, and TopicFile cleanup and backup requirements are addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rails, ruby
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100