Struct algorithmia::data::dir::DataFileEntry
[−]
[src]
pub struct DataFileEntry { pub size: u64, pub last_modified: DateTime<UTC>, // some fields omitted }
Fields
size: u64
last_modified: DateTime<UTC>
Methods from Deref<Target=DataFile>
fn put<'a, B: Into<Body<'a>>>(&'a self, body: B) -> Result<FileAdded, Error>
Write to the Algorithmia Data API
Examples
let client = Algorithmia::client("111112222233333444445555566"); client.clone().file(".my/my_dir/string.txt").put("file_contents"); client.clone().file(".my/my_dir/bytes.txt").put("file_contents".as_bytes()); let mut stdin = io::stdin(); let data_file = client.clone().file(".my/my_dir/stdin.txt"); data_file.put(&mut stdin);
fn get(&self) -> Result<DataResponse, Error>
Get a file from the Algorithmia Data API
Examples
let client = Algorithmia::client("111112222233333444445555566"); let my_file = client.file(".my/my_dir/sample.txt"); match my_file.get() { Ok(mut response) => { let mut data = String::new(); match response.read_to_string(&mut data) { Ok(_) => println!("{}", data), Err(err) => println!("IOError: {}", err), } }, Err(err) => println!("Error downloading file: {}", err), };
fn delete(&self) -> Result<FileDeleted, Error>
Delete a file from from the Algorithmia Data API
Examples
let client = Algorithmia::client("111112222233333444445555566"); let my_file = client.file(".my/my_dir/sample.txt"); match my_file.delete() { Ok(_) => println!("Successfully deleted file"), Err(err) => println!("Error deleting file: {}", err), };