rclone: github.com/ncw/rclone/cmd/serve/webdav Index | Files

package webdav

import "github.com/ncw/rclone/cmd/serve/webdav"

Package webdav implements a WebDAV server backed by rclone VFS


Package Files



var Command = &cobra.Command{
    Use:   "webdav remote:path",
    Short: `Serve remote:path over webdav.`,
    Long: "" /* 583 byte string literal not displayed */+
        httplib.Help + vfs.Help + proxy.Help,
    RunE: func(command *cobra.Command, args []string) error {
        var f fs.Fs
        if proxyflags.Opt.AuthProxy == "" {
            cmd.CheckArgs(1, 1, command, args)
            f = cmd.NewFsSrc(args)
        } else {
            cmd.CheckArgs(0, 0, command, args)
        hashType = hash.None
        if hashName == "auto" {
            hashType = f.Hashes().GetOne()
        } else if hashName != "" {
            err := hashType.Set(hashName)
            if err != nil {
                return err
        if hashType != hash.None {
            fs.Debugf(f, "Using hash %v for ETag", hashType)
        cmd.Run(false, false, command, func() error {
            s := newWebDAV(f, &httpflags.Opt)
            err := s.serve()
            if err != nil {
                return err
            return nil
        return nil

Command definition for cobra

type FileInfo Uses

type FileInfo struct {

FileInfo represents info about a file satisfying os.FileInfo and also some additional interfaces for webdav for ETag and ContentType

func (FileInfo) ContentType Uses

func (fi FileInfo) ContentType(ctx context.Context) (contentType string, err error)

ContentType returns a content type for the FileInfo

func (FileInfo) ETag Uses

func (fi FileInfo) ETag(ctx context.Context) (etag string, err error)

ETag returns an ETag for the FileInfo

type Handle Uses

type Handle struct {

Handle represents an open file

func (Handle) Readdir Uses

func (h Handle) Readdir(count int) (fis []os.FileInfo, err error)

Readdir reads directory entries from the handle

func (Handle) Stat Uses

func (h Handle) Stat() (fi os.FileInfo, err error)

Stat the handle

type WebDAV Uses

type WebDAV struct {
    // contains filtered or unexported fields

WebDAV is a webdav.FileSystem interface

A FileSystem implements access to a collection of named files. The elements in a file path are separated by slash ('/', U+002F) characters, regardless of host operating system convention.

Each method has the same semantics as the os package's function of the same name.

Note that the os.Rename documentation says that "OS-specific restrictions might apply". In particular, whether or not renaming a file or directory overwriting another existing file or directory is an error is OS-dependent.

func (*WebDAV) Mkdir Uses

func (w *WebDAV) Mkdir(ctx context.Context, name string, perm os.FileMode) (err error)

Mkdir creates a directory

func (*WebDAV) OpenFile Uses

func (w *WebDAV) OpenFile(ctx context.Context, name string, flags int, perm os.FileMode) (file webdav.File, err error)

OpenFile opens a file or a directory

func (*WebDAV) RemoveAll Uses

func (w *WebDAV) RemoveAll(ctx context.Context, name string) (err error)

RemoveAll removes a file or a directory and its contents

func (*WebDAV) Rename Uses

func (w *WebDAV) Rename(ctx context.Context, oldName, newName string) (err error)

Rename a file or a directory

func (*WebDAV) Stat Uses

func (w *WebDAV) Stat(ctx context.Context, name string) (fi os.FileInfo, err error)

Stat returns info about the file or directory

Package webdav imports 19 packages (graph) and is imported by 7 packages. Updated 2020-07-05. Refresh now. Tools for package owners.