Bifrost
Karolinska Institutet Neuro Research Group · data bridge

Command line

The bifrost tool for large transfers

One small program for Linux, macOS and Windows. It uses the same token as the browser, sends or fetches whole folder trees with several streams at once, packs small files together so thousands of them travel as a few streams, resumes after any interruption, and verifies every file. Nothing else to install.

Install

Linux or macOS (puts bifrost in ~/.local/bin):

curl -fsSL https://bifrost.kineuro.se/get | sh

Windows (PowerShell):

irm https://bifrost.kineuro.se/get.ps1 | iex

Or download a binary from the download list: bifrost-linux-amd64, bifrost-linux-arm64, bifrost-darwin-amd64, bifrost-darwin-arm64, bifrost-windows-amd64.exe. Checksums are in SHA256SUMS.

macOS may say the program is from an unidentified developer. The installer clears that flag; for a manual download run xattr -d com.apple.quarantine bifrost once.

Sign in

bifrost login bfr_…            # the token, or the whole link you were given

Login shows what the token opens, so you know before sending anything:

────────────────────────────────────────────────────────────────
  MS cohort from Uppsala
  for Uppsala University, Dr Lind (token: Dr Lind)
────────────────────────────────────────────────────────────────
  you can        send files to the group (no download)
  status         open, closes 2026-12-31 (122 days left)
  space          0 B of 2.0 TB used
  message        Please send the T1 and FLAIR series, anonymised.
  bridge         https://bifrost.kineuro.se (ms-cohort-from-uppsala)
────────────────────────────────────────────────────────────────

bifrost status prints the same summary at any time, with the current usage.

The token is saved in your user configuration folder (~/.config/bifrost/config.json on Linux, ~/Library/Application Support/bifrost on macOS, %AppData%\bifrost on Windows). For scripts, set BIFROST_TOKEN instead and skip login. If the bridge has a passcode, login asks for it once.

Send a folder

bifrost push /data/study_2026

This indexes the folder, asks the bridge which files it already has, then sends the rest. On the bridge the data lands under a folder with the same name (study_2026/); use --to to choose another name. When it finishes, every file has been verified by checksum and the group is notified.

What you see while it runs:

306475 files indexed; 0 already on the bridge; 306475 to send (1.9 TB); 6 streams
 37.2%  707.1 GB of 1.9 TB  114020/306475 files  312.4 MB/s  eta 1h04m
Interrupted? Press Ctrl-C, close the laptop, lose the network: nothing is lost. Run the same command again and it continues from where it stopped, on any computer that has the same data and token. Files already on the bridge are skipped in seconds.

Fetch what was prepared for you

bifrost ls                       # see what is there
bifrost pull /data/from_kineuro    # fetch everything into that folder
bifrost pull ./sub --from release_2026/derivatives   # only one folder

Files already present locally with the right size are skipped (add --checksum to compare hashes too). Big files are fetched in parallel parts and resume; small files arrive packed together.

Check afterwards

bifrost verify /data/study_2026

Hashes every local file and compares with the bridge. Exit code 0 means everything matches.

Options

OptionMeaning
--to <path>push: put the data under this folder on the bridge (default: the folder's own name)
--from <path>pull: fetch only this folder
--workers <n>parallel streams (default 6; the bridge sets a ceiling and tells the tool to wait when it is busy)
--limit 50Mbandwidth cap in bytes per second (K, M, G suffixes), for a shared office line
--exclude '*.tmp'skip matching names or paths; repeatable
--checksumhash everything first and skip only exact matches (default: same size counts as present)
--dry-runlist what would be transferred and stop
--jsonone JSON line per event, for scripts and schedulers

Exit codes: 0 everything done, 2 some files failed (run again), 130 interrupted (run again).

How it goes fast

  • Files of 64 MB or more are sent as 32 MB parts, several in flight per file, each part checked on arrival.
  • Smaller files are packed into batches (about 256 MB or 5,000 files), compressed on the fly and sent as one stream, so a DICOM study with hundreds of thousands of small files is a few hundred requests instead of a few hundred thousand.
  • Six streams by default; the bridge has a global budget and asks the tool to pause briefly when many partners transfer at once, so nobody's transfer starves the others.
  • The bridge keeps the list of what it has received, so a resume needs no local state and works from another machine.

Keeping it current

bifrost version                  # what you have
bifrost update                   # fetch and install the newest build, in place

update asks the bridge which version it serves, downloads the binary for your system and replaces itself; no installer, no administrator rights beyond writing its own file. If you are already current it says so. The tool and the bridge are released together, so run update when a transfer reports an error you do not expect or when the group asks you to. On Windows the previous binary is kept as bifrost.exe.old until the next update.

Scheduled or scripted transfers

export BIFROST_TOKEN=bfr_…
bifrost push /export/nightly --to nightly --json >> bifrost.log || echo "some files failed, will retry tomorrow"

A nightly job that re-runs the same push is safe: unchanged files are skipped, new or changed files are sent, and the exit code tells you whether to look at the log.

Where does the data go?

Into an isolated exchange area on the group's storage server, one folder per bridge, reachable only by this service and the group's administrators. Nothing you send is mixed with anything else until an administrator reviews and accepts it into a study. Problems or questions: admin@kineuro.se.