This module implements an SFTP (SSH FTP) client. SFTP is a secure, encrypted file transfer service available for SSH.
Type definitions that are used more than once in this module and/or abstractions to indicate the intended use of the data type:
If the request functions for the SFTP channel return {error, timeout} it does not guarantee that the request did not reach the server and was not performed, it only means that we did not receive an answer from the server within the time that was expected.
If no connection reference is provided, a connection is set up and the new connection is returned. An SSH channel process is started to handle the communication with the SFTP server. The returned pid for this process should be used as input to all other API functions in this module.
Options are:
The timeout is passed to the ssh_channel start function, and defaults to infinity.
Desired SFTP protocol version. The actual version will be the minimum of the desired version and the maximum supported versions by the SFTP server.
All other options are directly passed to
Stops an SFTP channel. Does not close the SSH connetion.
Use
Reads a file from the server, and returns the data in a binary,
like
Writes a file to the server, like
Lists the given directory on the server, returning the filenames as a list of strings.
Opens a file on the server, and returns a handle that can be used for reading or writing.
Opens a handle to a directory on the server, the handle can be used for reading directory contents.
Opens a handle to a tar file on the server, the handle
can be used for remote tar manipulation as defined by the
Closes a handle to an open file or directory on the server.
Reads
If the file is read past eof, only the remaining bytes
will be read and returned. If no bytes are read,
The
Reads from an open file, without waiting for the result. If the
handle is valid, the function returns
The
Writes
Typical error reasons are:
The file is not opened for writing.
There is a no space left on the device.
Writes to an open file, without waiting for the result. If the
handle is valid, the function returns
The
Sets the file position of the file referenced by
The same as
Absolute offset.
Offset from the current position.
Offset from the end of file.
The same as above with
Returns a
Returns a
Writes file information from a
Reads the link target from the symbolic link specified
by
Creates a symbolic link pointing to
Renames a file named
Deletes the file specified by
Creates a directory specified by
Deletes a directory specified by