Struct inapi::File [] [src]

pub struct File { /* fields omitted */ }

Primitive for managing files.

Examples

Initialise a new Host:

let mut host = Host::connect("hosts/myhost.json").unwrap();

Now you can manage a file on your managed host.

let file = File::new(&mut host, "/path/to/destination_file").unwrap();
file.upload(&mut host, "/path/to/local_file", None);
file.set_owner(&mut host, "MyUser", "MyGroup").unwrap();
file.set_mode(&mut host, 644).unwrap();

// Now let's upload another file and backup the original
file.upload(&mut host, "/path/to/new_file", Some(&[
    FileOptions::BackupExisting("_bk".to_string())
])).unwrap();

// Your remote path now has two entries:
// "/path/to/destination_file" and "/path/to/destination_file_bk"

Methods

impl File
[src]

[src]

Create a new File struct.

[src]

Check if the file exists.

[src]

Upload a file to the managed host.

[src]

Upload a file handle to the managed host.

[src]

Delete the file.

[src]

Move the file to a new path.

[src]

Copy the file to a new path.

[src]

Get the file's owner.

[src]

Set the file's owner.

[src]

Get the file's permissions mask.

[src]

Set the file's permissions mask.