drive

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteDriveBackup added in v1.0.0

func DeleteDriveBackup(drivePath string) error

DeleteDriveBackup deletes the specified backup file in linux/backups.

func DownloadFromDrive added in v1.0.0

func DownloadFromDrive(drivePath, localPath string) error

DownloadFromDrive downloads a file from Google Drive /linux/backups/[filename] to localPath.

func GetLatestDriveBackup added in v1.0.0

func GetLatestDriveBackup() (string, error)

GetLatestDriveBackup returns the name of the most recently modified .tar.xz file in linux/backups/

func ListDriveBackups added in v1.0.0

func ListDriveBackups() ([]string, error)

ListDriveBackups returns the names of .tar.xz files in linux/backups.

func UploadToDrive added in v1.0.0

func UploadToDrive(localPath, drivePath string) error

UploadToDrive uploads a local file to Google Drive at /linux/backups/[filename]. This is left as a convenience wrapper using the underlying service. It preserves previous behavior.

Types

type DriveClient added in v1.0.0

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

DriveClient provides a small filesystem-like API over Google Drive.

func NewDriveClient added in v1.0.0

func NewDriveClient(ctx context.Context, basePath []string) (*DriveClient, error)

NewDriveClient creates and authenticates a DriveClient. If basePath is nil, the client will operate relative to Drive root unless absolute paths are provided.

func (*DriveClient) Ls added in v1.0.0

func (c *DriveClient) Ls(ctx context.Context, path string) ([]DriveEntry, error)

Ls lists the files and folders at the provided Drive-style path. Examples:

"" or "/"            -> list root
"linux/backups"      -> list that folder
"linux"              -> list linux folder

It does not create missing folders; if the specified path doesn't exist, an error is returned.

func (*DriveClient) Rm added in v1.0.0

func (c *DriveClient) Rm(ctx context.Context, path string) error

Rm deletes the file(s) specified by the path. Path should be like "linux/backups/mybackup.tar.xz". If multiple files match the name in the target folder, all matches are deleted. It will not delete folders unless the last path component is an explicit folder name and matches Drive entries.

type DriveEntry

type DriveEntry struct {
	ID           string
	Name         string
	MimeType     string
	ModifiedTime string
	Size         int64
	IsDir        bool
}

DriveEntry represents a Drive file/folder returned by Ls.

Jump to

Keyboard shortcuts

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