@@ -5,16 +5,33 @@ A pure Go client for the [tus resumable upload protocol](http://tus.io/)
5
5
## Example
6
6
7
7
``` go
8
- c , err := NewClient ( " http://localhost:1080/files/ " , " /videos/my-video.mp4 " , nil )
8
+ package main
9
9
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)
13
29
14
- err = c.Upload ()
30
+ // create the uploader.
31
+ uploader , _ := client.CreateUpload (upload)
15
32
16
- if err != nil {
17
- panic (err )
33
+ // start the uploading process.
34
+ uploader. Upload ( )
18
35
}
19
36
```
20
37
@@ -24,21 +41,21 @@ if err != nil {
24
41
25
42
Checksum, Termination and Concatenation extensions are not implemented yet.
26
43
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.
28
45
29
- ## Built in Storages
46
+ ## Built in Store
30
47
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 .
32
49
33
50
| Name | Backend | Dependencies |
34
51
| :----:| :-------:| :------------:|
35
- | MemoryStorage | In-Memory | None |
52
+ | MemoryStore | In-Memory | None |
36
53
37
54
## Future Work
38
55
39
- - [ ] SQLite storage
40
- - [ ] Redis storage
41
- - [ ] Memcached storage
56
+ - [ ] SQLite store
57
+ - [ ] Redis store
58
+ - [ ] Memcached store
42
59
- [ ] Checksum extension
43
60
- [ ] Termination extension
44
61
- [ ] Concatenation extension
0 commit comments