root / HServer / 00.Server / 00.Program / localFTPServer.js @ 41
이력 | 보기 | 이력해설 | 다운로드 (823 Bytes)
1 |
const FtpSrv = require('ftp-srv');
|
---|---|
2 |
const FileSystem = require('ftp-srv');
|
3 |
|
4 |
const hostname = '192.168.0.12';
|
5 |
const port = 9001;
|
6 |
|
7 |
const ftpServer = new FtpSrv('ftp://' + hostname + ':' + port); |
8 |
|
9 |
ftpServer.on('login', (data, resolve, reject) => {
|
10 |
|
11 |
resolve({ root: '/down', cwd: '/'}); |
12 |
}); |
13 |
|
14 |
ftpServer.on ( 'client-error', (connection, context, error) =>
|
15 |
{ |
16 |
console.dir(connection); |
17 |
console.log ( 'connection: ' + connection );
|
18 |
console.log ( 'context: ' + context );
|
19 |
console.log ( 'error: ' + error );
|
20 |
}); |
21 |
|
22 |
ftpServer.on ('RETR', (error, filePath) =>{
|
23 |
console.log('RETR');
|
24 |
}); |
25 |
|
26 |
ftpServer.on ('STOR', (error, filePath) =>{
|
27 |
console.log('STOR');
|
28 |
}); |
29 |
|
30 |
ftpServer.listen() |
31 |
.then(() => { |
32 |
console.log ( `Server running at http://${hostname}:${port}/` ); |
33 |
}); |