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<T: AsRef<Path>>(
&self,
filename: T,
flags: OpenFlags,
mode: i32,
open_type: OpenType,
) -> Result<File, Error>
pub fn open_mode<T: AsRef<Path>>( &self, filename: T, flags: OpenFlags, mode: i32, open_type: OpenType, ) -> Result<File, Error>
Open a handle to a file.
The mode will represent the permissions for the file (Wikipedia).
Sourcepub fn open<T: AsRef<Path>>(&self, filename: T) -> Result<File, Error>
pub fn open<T: AsRef<Path>>(&self, filename: T) -> 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<T: AsRef<Path>>(&self, dirname: T) -> Result<File, Error>
pub fn opendir<T: AsRef<Path>>(&self, dirname: T) -> Result<File, Error>
Helper to open a directory for reading its contents.
Sourcepub fn readdir<T: AsRef<Path>>(
&self,
dirname: T,
) -> Result<Vec<(PathBuf, FileStat)>, Error>
pub fn readdir<T: AsRef<Path>>( &self, dirname: T, ) -> 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.
The mode will set the permissions of the new directory (Wikipedia).
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.