Update README

This commit is contained in:
Arnaud 2025-10-17 14:27:31 +02:00
parent 40aadaf104
commit 27b68f6d8f
No known key found for this signature in database
GPG Key ID: 20E40A5D3110766F

View File

@ -171,7 +171,8 @@ buf := bytes.NewBuffer([]byte("Hello World!"))
onProgress := func(read, total int, percent float64, err error) {
// Do something with the data
}
cid, err := codex.UploadReader(UploadOptions{filepath: "hello.txt", onProgress: onProgress}, buf)
ctx := context.Background()
cid, err := codex.UploadReader(ctx, UploadOptions{filepath: "hello.txt", onProgress: onProgress}, buf)
```
#### file
@ -187,7 +188,8 @@ The `UploadFile` returns the cid of the content uploaded.
onProgress := func(read, total int, percent float64, err error) {
// Do something with the data
}
cid, err := codex.UploadFile(UploadOptions{filepath: "./testdata/hello.txt", onProgress: onProgress})
ctx := context.Background()
cid, err := codex.UploadFile(ctx, UploadOptions{filepath: "./testdata/hello.txt", onProgress: onProgress})
```
#### chunks
@ -242,7 +244,8 @@ opt := DownloadStreamOptions{
// Handle progress
},
}
err := codex.DownloadStream(cid, opt)
ctx := context.Background()
err := codex.DownloadStream(ctx, cid, opt)
```
#### chunks