Skip to content

FTP Writer

FTP Writer provides the ability to write files to remote FTP/SFTP servers, currently only supports writing text files.

Configuration Example

json
{
  "job": {
    "setting": {
      "speed": {
        "channel": 2,
        "bytes": -1
      }
    },
    "content": {
      "reader": {},
      "writer": {
        "name": "ftpwriter",
        "parameter": {
          "protocol": "sftp",
          "host": "***",
          "port": 22,
          "username": "xxx",
          "password": "xxx",
          "timeout": "60000",
          "connectPattern": "PASV",
          "path": "/tmp/data/",
          "fileName": "test",
          "writeMode": "truncate|append|nonConflict",
          "fieldDelimiter": ",",
          "encoding": "UTF-8",
          "nullFormat": "null",
          "dateFormat": "yyyy-MM-dd",
          "fileFormat": "csv",
          "useKey": false,
          "keyPath": "",
          "keyPass": "",
          "header": []
        }
      }
    }
  }
}

Parameters

ConfigurationRequiredData TypeDefault ValueDescription
protocolYesstringftpServer protocol, currently supports ftp and sftp transport protocols
hostYesstringNoneServer address
portNoint22/21FTP default is 21, SFTP default is 22
timeoutNoint60000Connection timeout for FTP server, in milliseconds (ms)
connectPatternNostringPASVConnection mode, only supports PORT, PASV modes. Used for FTP protocol
usernameYesstringNoneUsername
passwordYesstringNoneAccess password
useKeyNobooleanfalseWhether to use private key login, only valid for SFTP login
keyPathNostring~/.ssh/id_rsaPrivate key address
keyPassNostringNonePrivate key password, no need to configure if no private key password is set
pathYesstringNoneRemote FTP file system path information, FtpWriter will write multiple files under Path directory
fileNameYesstringNoneName of file to write, this filename will have random suffix added as actual filename for each thread
writeModeYesstringNoneData cleanup processing mode before writing, see below
fieldDelimiterYesstring,Field delimiter for reading