Skip to content

vole/btsync-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BTSync API

Golang client for the Bittorrent Sync API.

Example

package main

import (
  btsync "btsync-api"
  "fmt"
  "log"
)

func main() {
  // Create an instance of the client. Needs the configured
  // login, password, and port of the Sync API. The last 
  // argument is to enable debug logging.
  api := btsync.New("login", "password", 8080, true)

  // Get a list of Sync folders. All API methods return
  // a response and an error object.
  folders, err := api.GetFolders()
  if err != nil {
    log.Fatalf("Error! %s", err)
  }
  
  // Response objects map directly to the documented JSON
  // responses. However they are Golang style (caps/camelcase).
  for _, folder := range *folders {
    fmt.Printf("Sync folder %s has %d files\n", folder.Dir, folder.Files)
  }
  
  // Get Sync's current upload/download speed.
  speed, _ := api.GetSpeed()
  fmt.Printf("Speed: upload=%d, download=%d", speed.Upload, speed.Download)
}

Documentation

http://godoc.org/github.com/vole/btsync-api

About

Go client for the Bittorrent Sync API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages