A Node.js command-line tool for securely transferring large files and folders between computers via SFTP, proxied through a dedicated server.
Fileshare CLI allows you to quickly upload files and folders to a shared server, making them accessible via a web interface at https://fileshare.ct-42210.com.
- Upload files and folders via SFTP
- Delete files from the server
- Interactive menu navigation with arrow keys
- Progress tracking for file uploads
- Configurable SSH key and server settings
- Persistent configuration storage
# Install dependencies
npm install
# Run CLI locally
node src/index.js [command]# Install globally
npm install -g .
# Run from anywhere
fileshare [command]Configuration is stored in ~/.fileshare/.env and persists across different working directories.
Default values (can be customized via fileshare setup):
- SSH Key:
id_ed25519(located in~/.ssh/) - Server Host: Configure via setup command
- Server User:
root - Server Port: Configure via setup command
- Server Directory:
/root/fileshare
Note: You must configure your server host and port using fileshare setup before first use.
To configure the CLI, run:
fileshare setupThis will display your current configuration and allow you to:
- Change SSH key name
- Change server directory
- Change server host
- Change server port
- Test connection to server
Upload files or folders from the current directory:
fileshare
# or
fileshare uploadThe CLI will:
- Display all files and folders in the current directory
- Let you select a file or folder to upload
- Ask for confirmation
- Upload the selected item with progress tracking
- Display the public URL for accessing the uploaded content
Delete files from the server:
fileshare deleteThe CLI will:
- List all files on the server
- Let you select multiple files to delete (use space to select)
- Ask for confirmation
- Delete the selected files
- Display results
Configure password protection for downloads:
fileshare passwordNote: This feature requires server-side NGINX configuration and is not yet fully implemented.
Configure SSH key and server settings:
fileshare setupOptions:
- Change SSH key name
- Change server directory
- Change server host
- Change server port
- Test connection to server
Display application information:
fileshare aboutThis project follows the Negative Space Software CLI Design System with a three-layer architecture:
src/
├── commands/ # Command orchestration layer
│ ├── upload.js # Upload command
│ ├── delete.js # Delete command
│ ├── password.js # Password command
│ ├── setup.js # Setup command
│ └── about.js # About command
├── ui/ # User interface layer
│ ├── select.js # Interactive selection functions
│ └── display.js # Display/output functions
├── api/ # Data layer
│ └── sftp.js # SFTP operations wrapper
└── utils/ # Utilities
├── config.js # Configuration management
└── errors.js # Error handling
- commander (^14.0.1) - CLI framework and routing
- inquirer (^8.2.7) - Interactive prompts with arrow key navigation
- chalk (^4.1.2) - Terminal colors
- dotenv (^17.2.3) - Environment variable management
- ssh2-sftp-client (^10.0.3) - SFTP operations
- Connection: SSH key authentication to root user
- Server OS: Ubuntu Server
- Target Directory:
/root/fileshare - Web Server: NGINX on port 9091
- Public Access: https://fileshare.ct-42210.com (via Cloudflare Tunnel)
# Test individual commands
node src/index.js about
node src/index.js setup
# Test with different directories
cd /path/to/test
node /path/to/fileshare-cli/src/index.js- Small, focused functions (one task per function)
- Comprehensive error handling with complete stack traces
- Thorough code comments
- Consistent naming conventions:
- camelCase for JavaScript variables and functions
- kebab-case for file names
- UPPER_SNAKE_CASE for constants
All commands use try/catch blocks with complete error messages. The CLI never truncates errors and always displays full stack traces for debugging.
If you see "SSH key not found", run:
fileshare setupThen select "Change SSH key name" and enter the name of your SSH key (without path).
If the connection test fails:
- Verify your SSH key exists in
~/.ssh/ - Check that the key has correct permissions (
chmod 600 ~/.ssh/keyname) - Verify the server host and port are correct
- Test SSH connection manually:
ssh -i ~/.ssh/keyname -p PORT USER@HOST
Configuration is stored in ~/.fileshare/.env. To reset:
rm -rf ~/.fileshare
fileshare setupISC
Negative Space Software