MCPcopy Create free account
hub / github.com/bufbuild/buf / GetFile

Method GetFile

private/bufpkg/bufmodule/module_read_bucket.go:317–331  ·  view source on GitHub ↗
(ctx context.Context, path string)

Source from the content-addressed store, hash-verified

315}
316
317func (b *moduleReadBucket) GetFile(ctx context.Context, path string) (File, error) {
318 fileInfo, err := b.StatFileInfo(ctx, path)
319 if err != nil {
320 return nil, err
321 }
322 bucket, err := b.getBucket()
323 if err != nil {
324 return nil, err
325 }
326 readObjectCloser, err := bucket.Get(ctx, path)
327 if err != nil {
328 return nil, err
329 }
330 return newFile(fileInfo, readObjectCloser), nil
331}
332
333func (b *moduleReadBucket) StatFileInfo(ctx context.Context, path string) (FileInfo, error) {
334 bucket, err := b.getBucket()

Callers

nothing calls this directly

Calls 3

StatFileInfoMethod · 0.95
newFileFunction · 0.70
GetMethod · 0.65

Tested by

no test coverage detected