pub struct Sftp { /* private fields */ }
Expand description
Represents an open sftp channel for performing filesystem operations
Implementations§
Source§impl Sftp
impl Sftp
Sourcepub async fn open_with_mode<T, E>(
&self,
filename: T,
opts: OpenOptions,
) -> SftpChannelResult<File>
pub async fn open_with_mode<T, E>( &self, filename: T, opts: OpenOptions, ) -> SftpChannelResult<File>
Open a handle to a file.
Sourcepub async fn open<T, E>(&self, filename: T) -> SftpChannelResult<File>
pub async fn open<T, E>(&self, filename: T) -> SftpChannelResult<File>
Helper to open a file in the Read
mode.
Sourcepub async fn create<T, E>(&self, filename: T) -> SftpChannelResult<File>
pub async fn create<T, E>(&self, filename: T) -> SftpChannelResult<File>
Helper to create a file in write-only mode with truncation.
Sourcepub async fn open_dir<T, E>(&self, filename: T) -> SftpChannelResult<Dir>
pub async fn open_dir<T, E>(&self, filename: T) -> SftpChannelResult<Dir>
Helper to open a directory for reading its contents.
Sourcepub async fn read_dir<T, E>(
&self,
filename: T,
) -> SftpChannelResult<Vec<(Utf8PathBuf, Metadata)>>
pub async fn read_dir<T, E>( &self, filename: T, ) -> SftpChannelResult<Vec<(Utf8PathBuf, Metadata)>>
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 async fn create_dir<T, E>(
&self,
filename: T,
mode: i32,
) -> SftpChannelResult<()>
pub async fn create_dir<T, E>( &self, filename: T, mode: i32, ) -> SftpChannelResult<()>
Create a directory on the remote filesystem.
Sourcepub async fn remove_dir<T, E>(&self, filename: T) -> SftpChannelResult<()>
pub async fn remove_dir<T, E>(&self, filename: T) -> SftpChannelResult<()>
Remove a directory from the remote filesystem.
Sourcepub async fn metadata<T, E>(&self, filename: T) -> SftpChannelResult<Metadata>
pub async fn metadata<T, E>(&self, filename: T) -> SftpChannelResult<Metadata>
Get the metadata for a file, performed by stat(2).
Sourcepub async fn symlink_metadata<T, E>(
&self,
filename: T,
) -> SftpChannelResult<Metadata>
pub async fn symlink_metadata<T, E>( &self, filename: T, ) -> SftpChannelResult<Metadata>
Get the metadata for a file, performed by lstat(2).
Sourcepub async fn set_metadata<T, E>(
&self,
filename: T,
metadata: Metadata,
) -> SftpChannelResult<()>
pub async fn set_metadata<T, E>( &self, filename: T, metadata: Metadata, ) -> SftpChannelResult<()>
Set the metadata for a file.
Sourcepub async fn symlink<T1, T2, E1, E2>(
&self,
path: T1,
target: T2,
) -> SftpChannelResult<()>
pub async fn symlink<T1, T2, E1, E2>( &self, path: T1, target: T2, ) -> SftpChannelResult<()>
Create symlink at target
pointing at path
.
Sourcepub async fn read_link<T, E>(&self, path: T) -> SftpChannelResult<Utf8PathBuf>
pub async fn read_link<T, E>(&self, path: T) -> SftpChannelResult<Utf8PathBuf>
Read a symlink at path
.
Sourcepub async fn canonicalize<T, E>(
&self,
path: T,
) -> SftpChannelResult<Utf8PathBuf>
pub async fn canonicalize<T, E>( &self, path: T, ) -> SftpChannelResult<Utf8PathBuf>
Resolve the real path for path
.
Sourcepub async fn rename<T1, T2, E1, E2>(
&self,
src: T1,
dst: T2,
opts: RenameOptions,
) -> SftpChannelResult<()>
pub async fn rename<T1, T2, E1, E2>( &self, src: T1, dst: T2, opts: RenameOptions, ) -> SftpChannelResult<()>
Rename the filesystem object on the remote filesystem.
Sourcepub async fn remove_file<T, E>(&self, file: T) -> SftpChannelResult<()>
pub async fn remove_file<T, E>(&self, file: T) -> SftpChannelResult<()>
Remove a file on the remote filesystem.