diff options
author | narimiran <narimiran@disroot.org> | 2019-07-24 11:49:06 +0200 |
---|---|---|
committer | narimiran <narimiran@disroot.org> | 2019-07-24 11:49:06 +0200 |
commit | 5484352d26352db120ec53074ae9ac0a913af13c (patch) | |
tree | bcdbaf7d6987aeb295029add6e4f0e065797ca70 | |
parent | 8c93c692b95da7b19a88cc0d56a8cdd20e3ae576 (diff) | |
download | Nim-5484352d26352db120ec53074ae9ac0a913af13c.tar.gz |
fix asyncftpclient examples [ci skip]
-rw-r--r-- | lib/pure/asyncftpclient.nim | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/lib/pure/asyncftpclient.nim b/lib/pure/asyncftpclient.nim index 912b18c28..4c38e0b8c 100644 --- a/lib/pure/asyncftpclient.nim +++ b/lib/pure/asyncftpclient.nim @@ -21,13 +21,13 @@ ## In order to begin any sort of transfer of files you must first ## connect to an FTP server. You can do so with the ``connect`` procedure. ## -## .. code-block::nim -## import asyncdispatch, asyncftpclient -## proc main() {.async.} = -## var ftp = newAsyncFtpClient("example.com", user = "test", pass = "test") -## await ftp.connect() -## echo("Connected") -## waitFor(main()) +## .. code-block::nim +## import asyncdispatch, asyncftpclient +## proc main() {.async.} = +## var ftp = newAsyncFtpClient("example.com", user = "test", pass = "test") +## await ftp.connect() +## echo("Connected") +## waitFor(main()) ## ## A new ``main`` async procedure must be declared to allow the use of the ## ``await`` keyword. The connection will complete asynchronously and the @@ -41,16 +41,16 @@ ## working directory before you do so with the ``pwd`` procedure, you can also ## instead specify an absolute path. ## -## .. code-block::nim -## import asyncdispatch, asyncftpclient -## proc main() {.async.} = -## var ftp = newAsyncFtpClient("example.com", user = "test", pass = "test") -## await ftp.connect() -## let currentDir = await ftp.pwd() -## assert currentDir == "/home/user/" -## await ftp.store("file.txt", "file.txt") -## echo("File finished uploading") -## waitFor(main()) +## .. code-block::nim +## import asyncdispatch, asyncftpclient +## proc main() {.async.} = +## var ftp = newAsyncFtpClient("example.com", user = "test", pass = "test") +## await ftp.connect() +## let currentDir = await ftp.pwd() +## assert currentDir == "/home/user/" +## await ftp.store("file.txt", "file.txt") +## echo("File finished uploading") +## waitFor(main()) ## ## Checking the progress of a file transfer ## ======================================== @@ -59,20 +59,20 @@ ## by specifying a ``onProgressChanged`` procedure to the ``store`` or ## ``retrFile`` procedures. ## -## .. code-block::nim -## import asyncdispatch, asyncftpclient +## .. code-block::nim +## import asyncdispatch, asyncftpclient ## -## proc onProgressChanged(total, progress: BiggestInt, -## speed: float): Future[void] = -## echo("Uploaded ", progress, " of ", total, " bytes") -## echo("Current speed: ", speed, " kb/s") +## proc onProgressChanged(total, progress: BiggestInt, +## speed: float): Future[void] = +## echo("Uploaded ", progress, " of ", total, " bytes") +## echo("Current speed: ", speed, " kb/s") ## -## proc main() {.async.} = -## var ftp = newAsyncFtpClient("example.com", user = "test", pass = "test") -## await ftp.connect() -## await ftp.store("file.txt", "/home/user/file.txt", onProgressChanged) -## echo("File finished uploading") -## waitFor(main()) +## proc main() {.async.} = +## var ftp = newAsyncFtpClient("example.com", user = "test", pass = "test") +## await ftp.connect() +## await ftp.store("file.txt", "/home/user/file.txt", onProgressChanged) +## echo("File finished uploading") +## waitFor(main()) import asyncdispatch, asyncnet, nativesockets, strutils, parseutils, os, times |