How to use the basic-ftp.enterPassiveModeIPv4 function in basic-ftp

To help you get started, we’ve selected a few basic-ftp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github h3imdall / ftp-remote-edit / lib / connectors / ftp.js View on Github external
connect(connection) {
    const self = this;
    self.emit('debug', 'ftp:connect');

    self.client = new ftpClient.Client();

    // force PASV mode
    self.client.prepareTransfer = ftpClient.enterPassiveModeIPv4;

    // logging
    self.client.ftp.verbose = true;
    self.client.ftp.log = (message) => {
      if (message.startsWith('<') || message.startsWith('>')) {
        self.emit('log', message.replace(/\'+/g, "").replace(/\\r|\\n/g, " "));
      } else {
        self.emit('debug', 'ftp:debug: ' + message);
      }
    };

    // options
    let options = {
      host: connection.host,
      port: (connection.port) ? connection.port : 21,
      user: connection.user,

basic-ftp

FTP client for Node.js, supports FTPS over TLS, IPv6, Async/Await, and Typescript.

MIT
Latest version published 9 months ago

Package Health Score

80 / 100
Full package analysis