MCPcopy Create free account
hub / github.com/google/go-cloud / ExampleBucket_NewRangeReader

Function ExampleBucket_NewRangeReader

blob/example_test.go:56–72  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54}
55
56func ExampleBucket_NewRangeReader() {
57 // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored.
58 // PRAGMA: On gocloud.dev, hide lines until the next blank line.
59 ctx := context.Background()
60 var bucket *blob.Bucket
61
62 // Open the key "foo.txt" for reading at offset 1024 and read up to 4096 bytes.
63 r, err := bucket.NewRangeReader(ctx, "foo.txt", 1024, 4096, nil)
64 if err != nil {
65 log.Fatal(err)
66 }
67 defer r.Close()
68 // Copy from the read range to stdout.
69 if _, err := io.Copy(os.Stdout, r); err != nil {
70 log.Fatal(err)
71 }
72}
73
74func ExampleBucket_NewWriter() {
75 // PRAGMA: This example is used on gocloud.dev; PRAGMA comments adjust how it is shown and can be ignored.

Callers

nothing calls this directly

Calls 3

NewRangeReaderMethod · 0.95
CloseMethod · 0.65
CopyMethod · 0.65

Tested by

no test coverage detected