https://github.com/yglukhov/asyncssh
High level async libssh2 wrapper
https://github.com/yglukhov/asyncssh
Last synced: 7 months ago
JSON representation
High level async libssh2 wrapper
- Host: GitHub
- URL: https://github.com/yglukhov/asyncssh
- Owner: yglukhov
- License: mit
- Created: 2020-02-21T09:54:06.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-20T10:44:41.000Z (almost 5 years ago)
- Last Synced: 2025-01-24T22:27:20.579Z (9 months ago)
- Language: Nim
- Size: 7.81 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# asyncssh
High level async libssh2 wrapper- Supports tunneling. SSHSessions can be made on top of other SSHSessions.
```nim
import asyncdispatch, asyncssh, timesproc main() {.async.} =
# Login with username/password. Alternative methods are available.
let s = await newSSHSession("myhost.local", Port(22), "root", "mySecurePassword")
# Put file
await s.putFile(path = "hello.txt", mode = 0666, mtime = now(), atime = now(),
content = "Hello world!")
# Get file
let content = await s.getFile(path = "hello.txt")
assert(content == "Hello world!")# Execute commands
let (output, retCode) = await s.exec("uname")
assert(retCode == 0)
echo "Uname is: ", output# Close connection
s.shutdown()waitFor main()
```