Skip to content

Commit

Permalink
Updated README to include contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
bramvdbogaerde committed Dec 27, 2021
1 parent 6b33df6 commit f4c5073
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/bramvdbogaerde/go-scp/auth"
"golang.org/x/crypto/ssh"
"os"
"context"
)

func main() {
Expand Down Expand Up @@ -46,9 +47,10 @@ func main() {
defer f.Close()

// Finaly, copy the file over
// Usage: CopyFromFile(file, remotePath, permission)
// Usage: CopyFromFile(context, file, remotePath, permission)

err = client.CopyFromFile(*f, "/home/server/test.txt", "0655")
// the context can be adjusted to provide time-outs or inherit from other contexts if this is embedded in a larger application.
err = client.CopyFromFile(context.Background(), *f, "/home/server/test.txt", "0655")

if err != nil {
fmt.Println("Error while copying file ", err)
Expand Down

0 comments on commit f4c5073

Please sign in to comment.