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 mean 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 not provided, setups a ssh connection in this case a connection reference will be returned too. A 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.
All other options are directly passed to
Stops a sftp channel. If the ssh connection should be closed
call
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 is used for reading or writing.
Opens a handle to a directory on the server, the handle is used for reading directory contents.
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
Write
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
Read 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