Skip to main content
Yazi includes a Virtual Filesystem (VFS) that abstracts file operations across different storage backends. This enables seamless remote file management alongside local files using the same interface.

Overview

The VFS provides a unified API for file operations regardless of the underlying storage:
  • Local files - Standard filesystem operations
  • SFTP - SSH-based remote file access
  • Archive files - Navigate inside archives (future)
  • Custom providers - Extensible for new backends

Architecture

The VFS is implemented through a provider system in yazi-vfs/:

URL Scheme

Yazi uses URL-based paths to identify resources:

Example URLs

  • Local: /home/user/documents/file.txt
  • SFTP: sftp://server.example.com/var/www/
  • Archive: /home/user/archive.zip!/folder/file.txt (future)
  • Search: fzf://search-query

SFTP Support

Yazi provides full SFTP support for remote file management over SSH.

Configuration

Configure SFTP hosts in ~/.config/yazi/yazi.toml:

Connecting

Connect to SFTP servers using the cd command:
Yazi will:
  1. Authenticate via SSH agent or key file
  2. Establish SFTP connection
  3. Navigate to the specified path
  4. Display remote files like local ones

Connection Management

SFTP connections are pooled and reused for efficiency:
Connections are:
  • Persistent - Reused across operations
  • Automatic reconnect - Handle network interruptions
  • Concurrent - Multiple operations use same connection
  • Pooled - Connection pool prevents resource exhaustion

Supported Operations

All standard file operations work over SFTP:

Reading

  • List directories
  • Read file contents
  • Get file metadata
  • Follow symbolic links
  • Calculate directory sizes

Writing

  • Create files and directories
  • Copy files (SFTP → SFTP, local → SFTP, SFTP → local)
  • Move/rename files
  • Delete files and directories
  • Create symbolic links
  • Create hard links (if supported by server)

Bulk Operations

  • Copy multiple files
  • Bulk rename
  • Multi-select operations
  • Progress tracking for large transfers

Implementation

The SFTP provider is implemented in yazi-vfs/src/provider/sftp/sftp.rs:78:
Note the 512KB buffers for optimal throughput.

Progress Tracking

Large SFTP transfers show progress:
Progress updates stream via channel for real-time UI updates.

Cross-Provider Operations

The VFS seamlessly handles operations across different providers:

Local ↔ SFTP

Yazi automatically:
  • Routes to appropriate provider
  • Handles different path formats
  • Preserves attributes when possible
  • Shows unified progress tracking

Capabilities System

Providers declare their capabilities:
This enables:
  • Feature detection
  • Graceful degradation
  • Provider-specific optimizations
  • Error prevention

Metadata Handling

The VFS normalizes metadata across providers:
Cha (characteristics) includes:
  • File type (regular, directory, symlink)
  • Permissions
  • Size
  • Modified time
  • Link target (for symlinks)

Error Handling

VFS operations return standard I/O errors:
Errors are:
  • Consistent - Same error types across providers
  • Actionable - Clear error messages
  • Recoverable - Retry logic for network issues

Directory Reading

Directory listing works uniformly:

Performance Optimizations

The VFS includes several performance optimizations:

Connection Pooling

SFTP connections are pooled to avoid reconnection overhead.

Buffered I/O

Large buffers (512KB) maximize throughput:

Async Operations

All I/O is non-blocking and runs on Tokio runtime.

Parallel Transfers

Multiple files transfer simultaneously when possible.

Limitations

Current Limitations

  • Trash not supported - SFTP files are permanently deleted
  • No compression - Files transfer uncompressed
  • SFTP only - Other protocols (FTP, S3, etc.) not yet supported

Future Plans

  • Additional protocols (FTP, WebDAV, S3)
  • Archive mounting (browse ZIP/TAR as directories)
  • Custom search providers
  • Cloud storage integration

Advanced Usage

Case-Insensitive Paths

The VFS handles case-insensitive filesystems:
This resolves ambiguous paths on case-insensitive systems.

Absolute Path Resolution

Converts relative paths to absolute.

Identity Checking

Handles hard links and bind mounts correctly.

See Also