Skip to main content

WebDAV

WebDAV backend support.

Capabilities

This service can be used to:

  • stat
  • read
  • write
  • create_dir
  • delete
  • copy
  • rename
  • list
  • scan
  • presign
  • blocking

Notes

Bazel Remote Caching and Ccache HTTP Storage is also part of this service. Users can use webdav to connect those services.

Configuration

  • endpoint: set the endpoint for webdav
  • root: Set the work directory for backend

You can refer to [WebdavBuilder]'s docs for more information

Example

Via Builder

use anyhow::Result;
use opendal::services::Webdav;
use opendal::Operator;

#[tokio::main]
async fn main() -> Result<()> {
// create backend builder
let mut builder = Webdav::default();

builder.endpoint("127.0.0.1");
builder.username("xxx");
builder.password("xxx");

let op: Operator = Operator::new(builder)?.finish();

Ok(())
}

Via Config

use anyhow::Result;
use opendal::Operator;
use opendal::Scheme;
use std::collections::HashMap;

#[tokio::main]
async fn main() -> Result<()> {
let mut map = HashMap::new();
map.insert("endpoint".to_string(), "127.0.0.1".to_string());
map.insert("username".to_string(), "xxx".to_string());
map.insert("password".to_string(), "xxx".to_string());

let op: Operator = Operator::via_map(Scheme::Webdav, map)?;
Ok(())
}