pub struct Sftp { /* private fields */ }
Expand description
A handle to a remote filesystem over SFTP.
Instances are created through the sftp
method on a Session
.
Implementations§
source§impl Sftp
impl Sftp
sourcepub fn open_mode(
&self,
filename: &Path,
flags: OpenFlags,
mode: i32,
open_type: OpenType
) -> Result<File, Error>
pub fn open_mode(
&self,
filename: &Path,
flags: OpenFlags,
mode: i32,
open_type: OpenType
) -> Result<File, Error>
Open a handle to a file.
sourcepub fn open(&self, filename: &Path) -> Result<File, Error>
pub fn open(&self, filename: &Path) -> Result<File, Error>
Helper to open a file in the Read
mode.
sourcepub fn create(&self, filename: &Path) -> Result<File, Error>
pub fn create(&self, filename: &Path) -> Result<File, Error>
Helper to create a file in write-only mode with truncation.
sourcepub fn opendir(&self, dirname: &Path) -> Result<File, Error>
pub fn opendir(&self, dirname: &Path) -> Result<File, Error>
Helper to open a directory for reading its contents.
sourcepub fn readdir(&self, dirname: &Path) -> Result<Vec<(PathBuf, FileStat)>, Error>
pub fn readdir(&self, dirname: &Path) -> Result<Vec<(PathBuf, FileStat)>, Error>
Convenience function to read the files in a directory.
The returned paths are all joined with dirname
when returned, and the
paths .
and ..
are filtered out of the returned list.
sourcepub fn mkdir(&self, filename: &Path, mode: i32) -> Result<(), Error>
pub fn mkdir(&self, filename: &Path, mode: i32) -> Result<(), Error>
Create a directory on the remote file system.
sourcepub fn rmdir(&self, filename: &Path) -> Result<(), Error>
pub fn rmdir(&self, filename: &Path) -> Result<(), Error>
Remove a directory from the remote file system.
sourcepub fn stat(&self, filename: &Path) -> Result<FileStat, Error>
pub fn stat(&self, filename: &Path) -> Result<FileStat, Error>
Get the metadata for a file, performed by stat(2)
sourcepub fn lstat(&self, filename: &Path) -> Result<FileStat, Error>
pub fn lstat(&self, filename: &Path) -> Result<FileStat, Error>
Get the metadata for a file, performed by lstat(2)
sourcepub fn setstat(&self, filename: &Path, stat: FileStat) -> Result<(), Error>
pub fn setstat(&self, filename: &Path, stat: FileStat) -> Result<(), Error>
Set the metadata for a file.
sourcepub fn symlink(&self, path: &Path, target: &Path) -> Result<(), Error>
pub fn symlink(&self, path: &Path, target: &Path) -> Result<(), Error>
Create a symlink at target
pointing at path
.
sourcepub fn rename(
&self,
src: &Path,
dst: &Path,
flags: Option<RenameFlags>
) -> Result<(), Error>
pub fn rename(
&self,
src: &Path,
dst: &Path,
flags: Option<RenameFlags>
) -> Result<(), Error>
Rename a filesystem object on the remote filesystem.
The semantics of this command typically include the ability to move a
filesystem object between folders and/or filesystem mounts. If the
Overwrite
flag is not set and the destfile entry already exists, the
operation will fail.
Use of the other flags (Native or Atomic) indicate a preference (but not a requirement) for the remote end to perform an atomic rename operation and/or using native system calls when possible.
If no flags are specified then all flags are used.