Socket
Book a DemoInstallSign in
Socket

sftp-to-ftp

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sftp-to-ftp

[![NPM Version](https://img.shields.io/npm/v/sftp-to-ftp.svg?branch=main)](https://www.npmjs.com/package/sftp-to-ftp) [![Publish Size](https://badgen.net/packagephobia/publish/sftp-to-ftp)](https://packagephobia.now.sh/result?p=sftp-to-ftp) [![Downloads](

latest
Source
npmnpm
Version
1.1.3
Version published
Maintainers
1
Created
Source

SFTP-to-FTP Bridge

NPM Version Publish Size Downloads License: MIT

SSH/SFTP to FTP bridge for seamless file transfers

Create an FTP server that acts as a bridge to any SSH/SFTP server, allowing legacy FTP clients to interact with modern SSH servers. Instantly convert any SSH/SFTP server into an FTP-accessible resource. Perfect for:

  • Accessing SFTP directories directly in Windows File Explorer.
  • Using legacy FTP clients with modern SSH servers.
  • Exploring and managing remote files with any FTP-compatible tool.

Table of Contents

Installation

npm install sftp-to-ftp
# or globally
npm install -g sftp-to-ftp

Usage

Command Line Interface (3 Ways to Run)

  • Interactive Mode (Prompt for details):
    npx sftp-to-ftp
    
    Example output:
    Enter SSH host/IP: 192.168.0.105
    Enter SSH port (Default: 22): 22
    Enter SSH username (Leave empty if not needed): root
    Enter SSH password (Leave empty if not needed): ********
    Enter FTP host/IP (Default: 127.0.0.1): 127.0.0.1
    Enter FTP port (Default: 21): 21
    🟢 FTP server listening! ftp://127.0.0.1:21
    

Windows File Explorer Tip: Simply enter ftp://127.0.0.1:21 (or your custom host/port) in the address bar to browse your SFTP server like a local folder!

  • Direct Arguments (Fully automated):

    npx sftp-to-ftp --ssh-host 192.168.0.105 --ssh-port 22 --ssh-user root --ssh-pass PWD --ftp-host 127.0.0.1 --ftp-port 21
    
  • Anonymous Mode (No SSH credentials required if pre-authenticated):

    npx sftp-to-ftp --ssh-host 192.168.0.105 --ssh-port 22 --ftp-host 127.0.0.1 --ftp-port 21
    

Programmatic Usage

import { SSHToFTPBridge } from 'sftp-to-ftp';

// Create bridge to SSH server
const bridge = new SSHToFTPBridge(
  {
    host: 'your-ssh-server',
    port: 22,
    username: 'your-user',
    password: 'your-pass'
  },
  {
    host: '127.0.0.1' // Optional FTP host
    port: 21 // Optional FTP port
  }
);

// The FTP server is now running on port 21
// Connect with any FTP client to ftp://127.0.0.1:21

// To shutdown:
// await bridge.terminate();

API Reference

Class: SSHToFTPBridge

Constructor

new SSHToFTPBridge(sshConfig: SSHConfiguration, options?: { port?: number })
  • sshConfig (Object):
    • host (string) - SSH server hostname/IP
    • port (number) - SSH port (default: 22)
    • username (string) - SSH username
    • password (string) - SSH password
  • options (Object, optional):
    • host (string) - FTP server hostname/IP (default: 127.0.0.1)
    • port (number) - FTP server port (default: 21)

Methods

  • terminate(): Promise<void> - Shuts down the FTP server and disconnects from SSH

Class: FTPSession

(Advanced usage - for custom FTP server implementations)

Properties

  • authenticated (boolean) - Session authentication status
  • cwd (string) - Current working directory
  • transferType (string) - Current transfer type (A/I)

Methods

  • send(code: number, message: string): void - Send FTP response
  • resolvePath(relativePath: string): string - Resolve relative paths

Supported Commands

CommandDescriptionStatus
USERAuthentication username
PASSAuthentication password
LISTDirectory listing
RETRDownload file
STORUpload file
DELEDelete file
MKDCreate directory
RMDRemove directory
RNFRRename from
RNTORename to
CWDChange working directory
PWDPrint working directory
PASVPassive mode transfer
PORTActive mode transfer
TYPETransfer type (A/I)
SIZEGet file size
MDTMGet file modification time
QUITDisconnect

Contributing

Contributions are welcome! Please open an issue or submit a pull request on the GitHub repository.

License

sftp-to-ftp is licensed under the MIT license.

Author

@SheikhAminul
@SheikhAminul

FAQs

Package last updated on 23 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts