4 releases
Uses old Rust 2015
0.2.0 | Aug 24, 2018 |
---|---|
0.1.2 | May 9, 2016 |
0.1.1 | May 9, 2016 |
0.1.0 | May 9, 2016 |
#18 in #client-builder
17KB
360 lines
hyperdav
A basic, simple to use WebDAV client library.
Example
Here is how you would put a file on the server.
extern crate hyperdav;
use std::fs::OpenOptions;
use hyperdav::ClientBuilder;
fn main() {
let client = ClientBuilder::default()
.credentials(
"username",
"password",
)
.build("webdav_url")
.unwrap();
let f = OpenOptions::new()
.read(true)
.open("/foo/bar/file.txt")
.unwrap();
client.put(f, "file.txt");
}
lib.rs
:
hyperdav
The hyperdav
crate provides an API for interacting with the WebDAV protocol.
It's easy to use and handles all the abstractions over HTTP for the user.
GET request
#
let client = Client::new()
.credentials("foo", "bar")
.build("https://demo.owncloud.org/remote.php/webdav/")
.unwrap();
let mut res = client.get(&["file.txt"])?;
let mut buf = vec![];
res.copy_to(&mut buf)?;
The GET request will return a Response
from the reqwest
crate on
success.
PUT request
#
let client = Client::new()
.credentials("foo", "bar")
.build("https://demo.owncloud.org/remote.php/webdav/")
.unwrap();
let r = std::io::empty();
client.put(r, &["file.txt"])?;
# Ok(())
The PUT request will return ()
on success just to indicate it succeeded
Dependencies
~15–24MB
~419K SLoC