mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 12:05:05 +08:00
librclone:Added example on using librclone with golang.
This commit is contained in:
parent
a3eb7f1142
commit
2ad217eedd
|
@ -163,6 +163,29 @@ const char* input = "{"
|
||||||
With C++11 you can use raw string literals to avoid the C++ escaping of string
|
With C++11 you can use raw string literals to avoid the C++ escaping of string
|
||||||
constants, leaving escaping only necessary for the contained JSON.
|
constants, leaving escaping only necessary for the contained JSON.
|
||||||
|
|
||||||
|
## Example in golang
|
||||||
|
|
||||||
|
Here is a go example to help you move files :
|
||||||
|
|
||||||
|
```go
|
||||||
|
func main() {
|
||||||
|
librclone.Initialize()
|
||||||
|
syncRequest: = syncRequest {
|
||||||
|
SrcFs: "<absolute_path>",
|
||||||
|
DstFs: ":s3,env_auth=false,access_key_id=<access>,secret_access_key=<secret>,endpoint='<endpoint>':<bucket>",
|
||||||
|
}
|
||||||
|
|
||||||
|
syncRequestJSON, err: = json.Marshal(syncRequest)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
out, status: = librclone.RPC("sync/copy", string(syncRequestJSON))
|
||||||
|
fmt.Println("Got status : %d and output %q", status, out)
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
## gomobile
|
## gomobile
|
||||||
|
|
||||||
The `gomobile` subdirectory contains the equivalent of the C binding but
|
The `gomobile` subdirectory contains the equivalent of the C binding but
|
||||||
|
|
Loading…
Reference in New Issue
Block a user