I’m trying to create a web-based FTP client using JavaScript. My goal is to build something similar to FileZilla that runs in the browser. I have an FTP server set up on port 21 in my network, and I want users to access it through a webpage.
I’ve looked for JavaScript libraries to help with this, but most of what I found is for Node.js, which is backend. I need a frontend solution. I understand JavaScript has limitations when it comes to opening ports, so I’ve configured my FTP server in passive mode to work around this.
Has anyone successfully implemented a browser-based FTP client? Are there any frontend JavaScript libraries or approaches you’d recommend for this task? I’m open to any suggestions or examples that could point me in the right direction.
Here’s a basic structure I’m considering:
class BrowserFTPClient {
constructor(host, port) {
this.host = host;
this.port = port;
}
connect() {
// Implementation needed
}
listFiles() {
// Implementation needed
}
uploadFile(file) {
// Implementation needed
}
downloadFile(filename) {
// Implementation needed
}
}
// Usage
const ftpClient = new BrowserFTPClient('ftp.example.com', 21);
ftpClient.connect();
Any thoughts on how to flesh this out or alternative approaches?