Skip to content

Commit 9d9acae

Browse files
committed
docs: add simple usage example to README
1 parent a66d70d commit 9d9acae

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,36 @@ Download to a specific directory:
4141
```bash
4242
scdl https://soundcloud.com/cowboyclicker/stay --output ~/Music/
4343
```
44+
45+
## Library Usage
46+
47+
### Installation
48+
49+
```bash
50+
go get github.com/hellsontime/scdl
51+
```
52+
53+
### Simple Usage
54+
55+
```go
56+
import "github.com/hellsontime/scdl"
57+
58+
// ...
59+
60+
client, err := scdl.NewClient()
61+
if err != nil {
62+
return err
63+
}
64+
65+
// Fetch track metadata
66+
track, err := client.GetTrack("https://soundcloud.com/cowboyclicker/stay")
67+
if err != nil {
68+
return err
69+
}
70+
71+
// Download the track to the current directory
72+
path, err := client.Download(track, ".", nil) // progress callback is optional
73+
if err != nil {
74+
return err
75+
}
76+
```

0 commit comments

Comments
 (0)