| commit | 6511b9a448500c9fbfa8c162e36bd28d8d202c90 | [log] [tgz] |
|---|---|---|
| author | Xuanwo <github@xuanwo.io> | Tue Mar 01 17:25:53 2022 +0800 |
| committer | GitHub <noreply@github.com> | Tue Mar 01 17:25:53 2022 +0800 |
| tree | ccd055734cfaa57eb5adb85ac091b2ac8d15009c | |
| parent | e15d0fd5a6e41c8d4555ce9596b3bf8ae6599dc4 [diff] |
credential: Add Plain variant to allow more input (#78) Signed-off-by: Xuanwo <github@xuanwo.io>
Open Data Access Layer that connect the whole world together.
OpenDAL is in alpha stage and has been early adopted by databend. Welcome any feedback at Discussions!
use anyhow::Result; use futures::AsyncReadExt; use opendal::services::fs; use opendal::Operator; #[tokio::main] async fn main() -> Result<()> { let op = Operator::new(fs::Backend::build().root("/tmp").finish().await?); let o = op.object("test_file"); // Write data info file; let w = o.writer(); let n = w .write_bytes("Hello, World!".to_string().into_bytes()) .await?; assert_eq!(n, 13); // Read data from file; let mut r = o.reader(); let mut buf = vec![]; let n = r.read_to_end(&mut buf).await?; assert_eq!(n, 13); assert_eq!(String::from_utf8_lossy(&buf), "Hello, World!"); // Get file's Metadata let meta = o.metadata().await?; assert_eq!(meta.content_length(), 13); // Delete file. o.delete().await?; Ok(()) }
Check out the CONTRIBUTING.md guide for more details on getting started with contributing to this project.
OpenDAL is licensed under Apache 2.0.