-
Notifications
You must be signed in to change notification settings - Fork 1
/
content.go
39 lines (36 loc) · 666 Bytes
/
content.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package digestfs
import (
"io"
)
// Content provides a read-only interface to content.
//
// Example
//
// Here is an example of digestfs.Content being used.
//
// content, err := Open(algorithm, digest)
// if nil != err {
// return err
// }
// defer content.Close()
//
// // ...
//
// var buffer [128]byte
// p := buffer[:]
//
// n, err := content.ReadAt(p, offset)
//
// Reader, Seeker
//
// If you want to turn Content into a io.Reader, and io.Seeker, you can
// do that by wrapping it in a io.SectionReader.
//
// For example:
//
// r := io.NewSectionReader(content, 0, int64(content.Len()))
type Content interface {
io.Closer
io.ReaderAt
Len() int
}