ftp - ftp Client#

Adapted Air780E/Air700E Air780EP/Air780EPV Air601 Air101/Air103 Air105 ESP32C3 ESP32S3

Note

This page document is automatically generated by this file. If there is any error, please submit issue or help modify pr, thank you!

Tip

This library has its own demo,click this link to view ftp demo examples

ftp.login(adapter,ip_addr,port,username,password)#

FTP Client

Parameters

Incoming Value Type

Explanation

int

The adapter serial number can only be socket.ETH0, socket.STA, socket.AP. If it is not filled in, the platform’s own method will be selected, and then the last registered adapter will be selected.

string

ip_addr Address

string

port port, default 21

string

username User Name

string

password Password

bool/table

whether it is an ssl encrypted connection, default is no encryption, true is the simplest encryption without certificate, table is encrypted with certificate
server_cert server ca certificate data
client_cert client ca certificate data
client_key client private key encrypted data
client_password client private key password data

Return Value

return value type

explanation

bool/string

Return true on success Return true on failure string

Examples

ftp_login = ftp.login(nil,"xxx")

ftp.command(cmd)#

FTP Command

Parameters

Incoming Value Type

Explanation

string

cmd Commands currently supported:NOOP SYST TYPE PWD MKD CWD CDUP RMD DELE LIST

Return Value

return value type

explanation

string

Return true on success Return true on failure string

Examples

    // Empty operation to prevent connection breakage
    print(ftp.command("NOOP").wait())
    // Reports the operating system type of a remote system
    print(ftp.command("SYST").wait())
    // Specify file type
    print(ftp.command("TYPE I").wait())
    // Displays the current working directory name
    print(ftp.command("PWD").wait())
    // Create Directory
    print(ftp.command("MKD QWER").wait())
    // Change current working directory
    print(ftp.command("CWD /QWER").wait())
    // Return to the previous directory
    print(ftp.command("CDUP").wait())
    // Delete Directory
    print(ftp.command("RMD QWER").wait())
    // Get the list of file names in the current working directory.
    print(ftp.command("LIST").wait())
    // Delete File
    print(ftp.command("DELE /1/12222.txt").wait())

ftp.pull(local_name,remote_name)#

FTP File Download

Parameters

Incoming Value Type

Explanation

string

local_name Local File

string

remote_name Server Files

Return Value

return value type

explanation

bool/string

Return true on success Return true on failure string

Examples

ftp.pull("/1222.txt","/1222.txt").wait()

ftp.push(local_name,remote_name)#

FTP File Upload

Parameters

Incoming Value Type

Explanation

string

local_name Local File

string

remote_name Server Files

Return Value

return value type

explanation

bool/string

Return true on success Return true on failure string

Examples

ftp.push("/1222.txt","/1222.txt").wait()

ftp.close()#

FTP Client Shutdown

Parameters

None

Return Value

return value type

explanation

bool/string

Return true on success Return true on failure string

Examples

ftp.close().wait()

ftp.debug(onoff)#

Configure whether to open debug information

Parameters

Incoming Value Type

Explanation

boolean

Whether to turn on debug switch

Return Value

return value type

explanation

nil

No return value

Examples

None