Asyncftpclient: adding removeDir proc
This commit is contained in:
parent
723bc158ce
commit
bc19b71fd2
1 changed files with 6 additions and 0 deletions
|
|
@ -354,6 +354,10 @@ proc store*(ftp: AsyncFtpClient, file, dest: string,
|
||||||
|
|
||||||
await doUpload(ftp, destFile, onProgressChanged)
|
await doUpload(ftp, destFile, onProgressChanged)
|
||||||
|
|
||||||
|
proc removeDir*(ftp: AsyncFtpClient, dir: string) {.async.} =
|
||||||
|
## Delete a directory ``dir`` on the remote FTP server
|
||||||
|
assertReply(await ftp.send("RMD " & dir), "250")
|
||||||
|
|
||||||
proc newAsyncFtpClient*(address: string, port = Port(21),
|
proc newAsyncFtpClient*(address: string, port = Port(21),
|
||||||
user, pass = ""): AsyncFtpClient =
|
user, pass = ""): AsyncFtpClient =
|
||||||
## Creates a new ``AsyncFtpClient`` object.
|
## Creates a new ``AsyncFtpClient`` object.
|
||||||
|
|
@ -373,6 +377,8 @@ when not defined(testing) and isMainModule:
|
||||||
echo await ftp.listDirs()
|
echo await ftp.listDirs()
|
||||||
await ftp.store("payload.jpg", "payload.jpg")
|
await ftp.store("payload.jpg", "payload.jpg")
|
||||||
await ftp.retrFile("payload.jpg", "payload2.jpg")
|
await ftp.retrFile("payload.jpg", "payload2.jpg")
|
||||||
|
await ftp.createDir("deleteme")
|
||||||
|
await ftp.removeDir("deleteme")
|
||||||
echo("Finished")
|
echo("Finished")
|
||||||
|
|
||||||
waitFor main(ftp)
|
waitFor main(ftp)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue