Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the client error event is not triggered #352

Open
36ru opened this issue Feb 9, 2023 · 0 comments
Open

the client error event is not triggered #352

36ru opened this issue Feb 9, 2023 · 0 comments

Comments

@36ru
Copy link

36ru commented Feb 9, 2023

In what cases does the event trigger - client-error?

const FtpSrv = require('ftp-srv');

const port=2121;
const ftpServer = new FtpSrv({
  url: "ftp://0.0.0.0:" + port,
  anonymous: true,
  pasv_url: '0.0.0.0',
  pasv_max: 65535,
  pasv_min: 1024
});

ftpServer.on('login', ({ connection, username, password }, resolve, reject) => {
  if(username === 'anonymous' && password === 'anonymous'){
    return resolve({ root:"/" });
  }
  return reject(new errors.GeneralError('Invalid username or password', 401));
});

ftpServer.on('client-error', (data) => {
  console.log(data);
});

ftpServer.on('server-error', ({error}) => {
  console.log(error);
});

ftpServer.listen().then(() => {
  console.log('Ftp server is starting...')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant