@hydren/ftp
v1.0.2
Published
A minimal FTP-like server built only with Node.js core modules, using .hdb plaintext user storage.
Readme
@hydren/ftp
A minimal FTP-like server built in pure Node.js (no external dependencies).
Supports multiple users, each mapped to their own directory.
User accounts are stored in a plaintext .hdb file.
✨ Features
- 🚀 Pure Node.js (
net,fs,pathonly). - 👤 Multiple accounts with username, password, and per-user directories.
- 📂 Simple
.hdbdatabase (plaintext). - ⚡ FTP-like commands supported:
USER,PASS→ loginPWD→ show current directoryLIST→ list filesRETR <file>→ download fileSTOR <file>→ upload fileQUIT→ logout
📦 Installation
npm install @hydren/ftp🚀 Usage
const FTPServer = require("@hydren/ftp");
// Create server on port 3002 with users stored in users.hdb
const server = new FTPServer(3002, "users.hdb");
// Add some users
server.newUser("alice", "password1", "./ftp/alice");
server.newUser("bob", "password2", "./ftp/bob");
// Start the server
server.start();📂 Users Database (users.hdb)
Example file:
--TABLE USERS--
alice|password1|./ftp/alice
bob|password2|./ftp/bobAccounts can be added via:
server.newUser("username", "password", "./directory");When you add a user, their directory is automatically created if missing.
🔗 Connecting
You can connect with telnet or netcat (since this is a simplified FTP implementation):
telnet localhost 3002Example session:
220 Welcome to NodeJS FTP Server
USER alice
331 Username OK, need password
PASS password1
230 Login successful
LIST
150 Opening ASCII mode data connection for file list
example.txt
226 Transfer complete
QUIT
221 Goodbye⚠️ Standard FTP clients (like FileZilla/WinSCP) may not work yet, because passive/active data channels are not implemented.
⚠️ Limitations
- Not fully RFC-compliant FTP.
- No TLS/SSL.
- Passwords stored in plaintext (
.hdb). - Only a few commands supported.
📜 License
This project is licensed under the HydDSMS License. See the LICENSE file for details.
