forked from rinie/nodeftpd
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathtest.js
24 lines (21 loc) · 775 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var ftpd = require('./ftpd.js');
var server = ftpd.createServer("127.0.0.1", "/home/alan/temporary/ftpd");
// this event passes in the client socket which emits further events
// but should recommend they don't do socket operations on it
// so should probably encapsulate and hide it
server.on("client:connected", function(socket) {
var username = null;
console.log("client connected: " + socket.remoteAddress);
socket.on("command:user", function(user, success, failure) {
if (user) {
username = user;
success();
} else failure();
});
socket.on("command:pass", function(pass, success, failure) {
if (pass) success(username);
else failure();
});
});
server.debugging = 4;
server.listen(7001);