Documentation ¶
Index ¶
Constants ¶
View Source
const ( // FileUploadNameHeader is the header sent to the authorized server when requesting the one-time // authorized upload request. FileUploadNameHeader = "X-File-Name" // FileUploadSizeHeader is the header sent to the authorized server when requesting the one-time // authorized upload request. FileUploadSizeHeader = "X-File-Size" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NoSuchFolderError ¶
type NoSuchFolderError struct { // Path is the folder path. Path string }
NoSuchFolderError is a mnemonic error that implments Is(target error) bool.
func (*NoSuchFolderError) Error ¶
func (e *NoSuchFolderError) Error() string
Error returns a string representation of the error.
func (*NoSuchFolderError) Is ¶
func (e *NoSuchFolderError) Is(target error) bool
Is is a function to be used with errors.Is(err, target error) bool.
type Service ¶
type Service interface { // DownloadFile downloads a file storing it in the local file system and returns the number of // bytes written. DownloadFile(relativePath, url string, headers http.Header) (int64, error) // UploadFile uploads a file first requesting a one-time authorized upload request to an // authorized server. // FileUploadNameHeader and FileUploadSizeHeader are sent with the file name and size when // requesting the one-time authorized request. UploadFile(relativePath string, authorizedServerURL string) error // Compress compresses a file or a folder into a .tar.gz file. Compress(inputRelativePath, outputRelativePath string) error // Uncompress uncompresses a .tar.gz file to file or a folder. Uncompress(inputRelativePath, outputRelativePath string) error // RemoveFileTree removes a file tree in the given relative path. RemoveFileTree(relativePath string) error // OpenFile opens the file stored in relative path and returns an io.ReadCloser. OpenFile(relativePath string) (io.ReadCloser, error) // CreateFile creates a file in the given relative path. CreateFile(relativePath string) (io.WriteCloser, error) // ListFiles returns a list of files (folders are discarded) contained in the given path. ListFiles(relativePath string) ([]string, error) // MoveFileTree moves a file tree in the old path to the new path. MoveFileTree(oldRelativePath, newRelativePath string) error }
Service provides methods to manipulate files.
func NewService ¶
func NewService(runtime serviceRuntime) Service
NewService returns a new instance of the default implementation of Service. If nil is passed, the default Service will be created with the default serviceRuntime.
Click to show internal directories.
Click to hide internal directories.