Project

sfdown

0.0
The project is in a healthy, maintained state
Clones a SourceForge project's directory tree and downloads its files by scraping the Files pages (SourceForge has no official API). Runs in two stages - map the tree, then download - with a live status bar and optional JSON metadata. Supports concurrency, file integrity verification (MD5 / SHA1), file deduplication, and resuming interrupted downloads.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

~> 1.11
 Project Readme

sfdown

Gem Version Gem

SourceForge project downloader. Will clone the project's directory tree and fetch all files.

Supports concurrency, integrity verification, file deduplication and resuming interrupted downloads.

Installation

gem install sfdown

Usage

Run with:

sfdown project_name [-lmn] [-c concurrent] [-i input] [-o output] [-t timeout] [-s sleep]

Arguments:

Arguments Default Description
-c or --concurrent 4 Number of parallel network workers, used in both stages
-i or --input None Bootstrap the download directly from a metadata JSON file
-l or --link False Hard-link duplicate files instead of copying them
-m or --metadata False Save metadata as JSON to disk at project's root
-n or --no False Only fetch directory tree structure and file metadata, not files
-o or --output Current dir Path to store project's root
-t or --timeout 5 Timeout for each GET request
-s or --sleep 0 Wait in-between requests

Features

Integrity verification

SourceForge publishes each file's MD5 / SHA1 hash. Whenever available, this is used after downloading to verify file integrity. SHA1 is preferred for its strength, MD5 is used as a fallback. Mismatches aren't discarded, simply logged.

File deduplication

The MD5 / SHA1 hashes are also used so that files that appear more than once in a project are downloaded only once: the first copy is fetched, the rest are copied from it locally. Progress totals only count the bytes that actually need fetching.

With -l the duplicates are hard-linked instead, so they take no extra disk space at all. If the filesystem doesn't support linking, sfdown warns once and falls back to copying.

Bootstrapping downloads

The process happens in two stages:

  • Stage 1 browses the directory tree and maps it out, optionally exporting the metadata to a JSON file (-m flag).
  • Stage 2 creates the directory tree and fetches all files.

Stage 2 can be started directly from a preexisting metadata file exported in stage 1 (-i flag).

Concurrency and throttling

Multiple workers can be used in parallel for both stages via the -c flag.

To prevent rate-limits, an optional sleep can be added between fetches via the -s flag.

Note: -s is applied per worker, so with -c the effective request rate scales roughly linearly with the number of workers.

Resuming interrupted downloads

The download process (stage 2) can be resumed by simply running the same command again, whether the process had been bootstrapped with -i or not.

Before downloading anything, sfdown checks each file's local path and verifies any existing copy against its published MD5 / SHA1 hash. Files that match are kept and skipped; anything missing, corrupt, or unverifiable (no checksum) is re-downloaded.