Skip to content
This repository was archived by the owner on Jul 10, 2022. It is now read-only.

Commit eb2807d

Browse files
Use io.Reader as input.
1 parent a658019 commit eb2807d

File tree

15 files changed

+585
-318
lines changed

15 files changed

+585
-318
lines changed

README.md

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,33 @@ A pure Go client for the [tus resumable upload protocol](http://tus.io/)
55
## Example
66

77
```go
8-
c, err := NewClient("http://localhost:1080/files/", "/videos/my-video.mp4", nil)
8+
package main
99

10-
if err != nil {
11-
panic(err)
12-
}
10+
import (
11+
"os"
12+
"github.com/eventials/go-tus"
13+
)
14+
15+
func main() {
16+
f, err := os.Open("my-file.txt")
17+
18+
if err != nil {
19+
panic(err)
20+
}
21+
22+
defer f.Close()
23+
24+
// create the tus client.
25+
client, _ := tus.NewClient("https://tus.example.org/files", nil)
26+
27+
// create an upload from a file.
28+
upload, _ := tus.NewUploadFromFile(f)
1329

14-
err = c.Upload()
30+
// create the uploader.
31+
uploader, _ := client.CreateUpload(upload)
1532

16-
if err != nil {
17-
panic(err)
33+
// start the uploading process.
34+
uploader.Upload()
1835
}
1936
```
2037

@@ -24,21 +41,21 @@ if err != nil {
2441
2542
Checksum, Termination and Concatenation extensions are not implemented yet.
2643

27-
This client allows to resume an upload if a Storage is used.
44+
This client allows to resume an upload if a Store is used.
2845

29-
## Built in Storages
46+
## Built in Store
3047

31-
Storages are used to save the progress of an upload.
48+
Store is used to map an upload's fingerprint with the corresponding upload URL.
3249

3350
| Name | Backend | Dependencies |
3451
|:----:|:-------:|:------------:|
35-
| MemoryStorage | In-Memory | None |
52+
| MemoryStore | In-Memory | None |
3653

3754
## Future Work
3855

39-
- [ ] SQLite storage
40-
- [ ] Redis storage
41-
- [ ] Memcached storage
56+
- [ ] SQLite store
57+
- [ ] Redis store
58+
- [ ] Memcached store
4259
- [ ] Checksum extension
4360
- [ ] Termination extension
4461
- [ ] Concatenation extension

0 commit comments

Comments
 (0)