drive

package
v0.0.0-...-941dbc7 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service google drive API wrapper

func NewService

func NewService(client *http.Client) (*Service, error)

NewService returns new service instance

func (*Service) CreateDir

func (s *Service) CreateDir(name string, parentID string) (*drive.File, error)

CreateDir creates a directory at google drive

func (*Service) Download

func (s *Service) Download(f *drive.File) error

Download downloads file from drive

func (*Service) Get

func (s *Service) Get(name string) (*drive.File, error)

Get finds file with given name on drive if there are multiple files with given name method returns latest modified

func (*Service) List

func (s *Service) List(limit int) ([]*drive.File, error)

List returns list of files contained in drive

func (*Service) Upload

func (s *Service) Upload(filePath string) (*drive.File, error)

type WriteCounter

type WriteCounter struct {
	Total uint64
}

WriteCounter counts the number of bytes written to it. It implements to the io.Writer interface and we can pass this into io.TeeReader() which will report progress on each write cycle.

func (WriteCounter) PrintProgress

func (wc WriteCounter) PrintProgress()

func (*WriteCounter) Write

func (wc *WriteCounter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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