webdav

package
v0.0.0-...-c8acfb9 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package webdav provides WebDAV file sharing and synchronization.

Copyright (c) 2018 - 2024 PhotoPrism UG. All rights reserved.

This program is free software: you can redistribute it and/or modify
it under Version 3 of the GNU Affero General Public License (the "AGPL"):
<https://docs.photoprism.app/license/agpl>

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

The AGPL is supplemented by our Trademark and Brand Guidelines,
which describe how our Brand Assets may be used:
<https://www.photoprism.app/trademark>

Feel free to send an email to hello@photoprism.app if you have questions, want to support our work, or just want to say hello.

Additional information can be found in our Developer Guide: <https://docs.photoprism.app/developer-guide/>

Index

Constants

View Source
const MaxRequestDuration = 30 * time.Minute

MaxRequestDuration is the maximum request duration e.g. for recursive retrieval of large remote directory structures.

View Source
const Second = time.Second

Second represents a second on which other timeouts are based.

Variables

Durations maps Timeout options to specific time durations.

Functions

This section is empty.

Types

type Client

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

Client represents a webdav client.

func NewClient

func NewClient(serverUrl, user, pass string, timeout Timeout) (*Client, error)

NewClient creates a new WebDAV client for the specified endpoint.

func (*Client) Delete

func (c *Client) Delete(dir string) error

Delete deletes a single file or directory on a remote server.

func (*Client) Directories

func (c *Client) Directories(dir string, recursive bool, timeout time.Duration) (result fs.FileInfos, err error)

Directories returns all subdirectories in a path as string slice.

func (*Client) Download

func (c *Client) Download(src, dest string, force bool) (err error)

Download downloads a single file to the given location.

func (*Client) DownloadDir

func (c *Client) DownloadDir(src, dest string, recursive, force bool) (errs []error)

DownloadDir downloads all files from a remote to a local directory.

func (*Client) Files

func (c *Client) Files(dir string, recursive bool) (result fs.FileInfos, err error)

Files returns information about files in a directory, optionally recursively.

func (*Client) Mkdir

func (c *Client) Mkdir(dir string) error

Mkdir creates a single remote directory.

func (*Client) MkdirAll

func (c *Client) MkdirAll(dir string) (err error)

MkdirAll recursively creates remote directories.

func (*Client) Upload

func (c *Client) Upload(src, dest string) (err error)

Upload uploads a single file to the remote server.

type Timeout

type Timeout string
const (
	TimeoutHigh    Timeout = "high"   // 120 * Second
	TimeoutDefault Timeout = ""       // 60 * Second
	TimeoutMedium  Timeout = "medium" // 60 * Second
	TimeoutLow     Timeout = "low"    // 30 * Second
	TimeoutNone    Timeout = "none"   // 0
)

Request Timeout options.

Jump to

Keyboard shortcuts

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