Skip to content

SFTP

The SFTP adapter downloads files from remote servers over SSH. Unlike other adapters, SFTP is a transport-only adapter — it downloads raw files rather than producing canonical CSV.

Provide SSH credentials via private key, password, or SSH agent.

Private key:

Terminal window
vgrid fetch sftp --host files.example.com --user deploy --key ~/.ssh/id_ed25519 ...

Password:

Terminal window
export SFTP_PASSWORD=...
vgrid fetch sftp --host files.example.com --user deploy ...

SSH agent: If neither --key nor --password is provided, VisiGrid falls back to the SSH agent.

Terminal window
vgrid fetch sftp \
--host files.example.com --user deploy --key ~/.ssh/id_ed25519 \
--remote-dir /exports/daily \
--glob "*.csv" \
--out ./downloads/

List available files without downloading:

Terminal window
vgrid fetch sftp \
--host files.example.com --user deploy --key ~/.ssh/id_ed25519 \
--remote-dir /exports/daily \
--list-only
FlagDescriptionDefault
--hostSFTP hostnamerequired
--portSFTP port22
--username / --userSSH usernamerequired
--private-key / --keyPath to SSH private key
--passphraseKey passphraseSFTP_KEY_PASSPHRASE env
--passwordPassword authSFTP_PASSWORD env
--remote-dirRemote directory to scanrequired
--globFilename filter pattern*.csv
--min-ageMin seconds since mtime before downloading120
--sinceOnly files with mtime >= this date (YYYY-MM-DD)
--outOutput directory for downloaded files
--stdoutWrite single file to stdoutoff
--known-hostsPath to known_hosts file~/.ssh/known_hosts
--known-hosts-outWhere to write TOFU’d keys
--trust-on-first-useAccept unknown host key and save itoff
--overwriteOverwrite even if content hash matchesoff
--max-filesLimit number of files to download
--list-onlyDry run: print files newest-first and exitoff
--provenanceProvenance output: sidecar, stderr, or nonesidecar
--state-dirDirectory for seen.jsonl state file
--reprocessRe-download even if recorded in state-diroff
-q / --quietSuppress progress messagesoff

Not applicable — SFTP downloads raw files and does not produce canonical CSV rows. Use --since to filter files by modification time.

Host key verification. VisiGrid checks the server’s host key against known_hosts (OpenSSH format). Use --trust-on-first-use to accept an unknown key and save it. On key mismatch, VisiGrid errors with both the presented and expected fingerprints.

Min-age filter. Files must be at least --min-age seconds old (default: 120) before they are downloaded, preventing partially-written files from being picked up.

Content-based dedup. VisiGrid computes a BLAKE3 hash during download. If a file already exists locally with a matching hash, it is skipped. Use --overwrite to force re-download.

State tracking. With --state-dir, VisiGrid maintains a seen.jsonl file recording each downloaded file’s path, mtime, size, and BLAKE3 hash. Previously-seen files are skipped on subsequent runs.

Provenance sidecar. Each downloaded file gets a .{filename}.visigrid.json sidecar containing the SFTP URI, file size, mtime, BLAKE3 hash, host key fingerprint, and CLI version.

Atomic writes. Files are written to a .part temporary file first, then atomically renamed on completion.

Stdout mode. Requires exactly one matching file. Provenance is written to stderr by default.