Documentation
¶
Index ¶
- Constants
- Variables
- func CachedDownload(urlStr, outputPath, hash string, quiet bool, postprocess func(string) error, ...) (string, error)
- func Download(urlStr, output string, opts DownloadOptions) (string, error)
- func DownloadFolder(urlStr, id, output string, opts FolderOptions) ([]string, error)
- func ExtractAll(archivePath, to string) ([]string, error)
- func IsGoogleDriveUrl(urlStr string) bool
- func MD5Sum(filename string) (string, error)
- func ParseUrl(urlStr string, warn bool) (fileId string, isDownloadLink bool, err error)
- type DownloadOptions
- type FileInfo
- type FileToDownload
- type FolderOptions
- type GoogleDriveFile
- type ThrottledWriter
Constants ¶
View Source
const ( CHUNK_SIZE = 512 * 1024 MAX_NUMBER_FILES = 50 )
Variables ¶
View Source
var ( // ErrFileURLRetrieval is returned when a file’s public URL cannot be determined. ErrFileURLRetrieval = errors.New("failed to retrieve file URL") )
Functions ¶
func CachedDownload ¶
func DownloadFolder ¶
func DownloadFolder(urlStr, id, output string, opts FolderOptions) ([]string, error)
func ExtractAll ¶
func IsGoogleDriveUrl ¶
Types ¶
type DownloadOptions ¶
type FileInfo ¶
type FileInfo struct { ID string Path string // relative path within the folder DownloadURL string // non-empty for files; empty for folders IsFolder bool }
New: FileInfo type and ListFolder function. FileInfo holds details about a file or folder within a Google Drive folder. For files, DownloadURL is provided so you can call Download individually.
func ListFolder ¶
func ListFolder(urlStr, id string, opts FolderOptions) ([]FileInfo, error)
ListFolder retrieves a folder’s structure and returns a list of FileInfo. Either urlStr or id must be specified (but not both). For files, DownloadURL is set.
type FileToDownload ¶
type FileToDownload struct { ID string Path string // relative path within the folder LocalPath string }
FileToDownload holds information for a file (or folder) within a folder.
type FolderOptions ¶
type FolderOptions struct { DownloadOptions RemainingOk bool }
type GoogleDriveFile ¶
type GoogleDriveFile struct { ID string Name string Type string Children []*GoogleDriveFile }
GoogleDriveFile represents a file or folder on Google Drive.
func (*GoogleDriveFile) IsFolder ¶
func (f *GoogleDriveFile) IsFolder() bool
type ThrottledWriter ¶
type ThrottledWriter struct {
// contains filtered or unexported fields
}
func NewThrottledWriter ¶
func NewThrottledWriter(w io.Writer, speed int64) *ThrottledWriter
Click to show internal directories.
Click to hide internal directories.