gcsfile

package module
v0.0.0-...-3343acd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 3 Imported by: 0

README

Quick Start


const (
    BucketName = "trivy-vm-images"
    ObjectName = "trivy-snapshot-image.vmdk"
)

func main() {
    ctx := context.Background()
    const blockSize  = 4096
    f, err := NewFile(ctx, BucketName, ObjectName)
    if err != nil {
        log.Fatal(err)
    }
    
    buf := make([]byte, blockSize)
    n, err := f.ReadAt(buf, 0)
    if err != nil {
        log.Fatal(err)
    }
    if n != blockSize {
        log.Fatal(xerrors.New("read bytes size error"))
    }
    
    fmt.Println(hex.Dump(buf))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	// contains filtered or unexported fields
}

func NewFile

func NewFile(ctx context.Context, bucket, name string) (*File, error)

func (*File) ReadAt

func (f *File) ReadAt(p []byte, off int64) (n int, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL