webdav

package
v0.13.5 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractFilename

func ExtractFilename(filePath string) string

ExtractFilename extracts the filename from a WebDAV path

func IsRemotePath

func IsRemotePath(rawURL string) bool

IsRemotePath checks if the URL is a remote path format (e.g., "pikpak:/path/to/file")

func IsWebDAVURL

func IsWebDAVURL(rawURL string) bool

IsWebDAVURL checks if a URL is a WebDAV URL or a remote path (remote:path)

func ParseRemotePath

func ParseRemotePath(remotePath string) (remoteName, filePath string, err error)

ParseRemotePath parses a remote path like "pikpak:/path/to/file" into remote name and path

func ParseURL

func ParseURL(rawURL string) (string, error)

ParseURL extracts the file path from a WebDAV URL

Types

type Client

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

Client wraps go-webdav client with convenience methods

func NewClient

func NewClient(rawURL string) (*Client, error)

NewClient creates a new WebDAV client URL format: webdav://user:pass@host/path or https://user:pass@host/path

func NewClientFromConfig

func NewClientFromConfig(server *config.WebDAVServer) (*Client, error)

NewClientFromConfig creates a WebDAV client from a configured server

func (*Client) GetAuthHeader

func (c *Client) GetAuthHeader() string

GetAuthHeader returns the Basic Auth header value if credentials are set

func (*Client) GetFileURL

func (c *Client) GetFileURL(filePath string) string

GetFileURL returns the full HTTP URL for a file path

func (*Client) List

func (c *Client) List(ctx context.Context, dirPath string) ([]FileInfo, error)

List returns the contents of a directory

func (*Client) Open

func (c *Client) Open(ctx context.Context, filePath string) (io.ReadCloser, int64, error)

Open opens a file for reading and returns the reader and file size

func (*Client) Stat

func (c *Client) Stat(ctx context.Context, filePath string) (*FileInfo, error)

Stat returns information about a file

func (*Client) SupportsRangeRequests

func (c *Client) SupportsRangeRequests(ctx context.Context, filePath string) (bool, error)

SupportsRangeRequests checks if the server supports HTTP Range requests for a file

type FileInfo

type FileInfo struct {
	Name  string
	Path  string
	Size  int64
	IsDir bool
}

FileInfo contains information about a remote file

Jump to

Keyboard shortcuts

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