View Source SFTPClient.Operations.OpenFile (SFTP Client v2.0.1)

A module that provides functions to open a file on an SFTP server in order to read their contents.

Summary

Functions

Opens a file on the server and returns a handle, which can be used for reading or writing.

Opens a file on the server and returns a handle, which can be used for reading or writing, then runs the function and closes the handle when finished.

Opens a file on the server and returns a handle, which can be used for reading or writing. Raises when the operation fails.

Opens a file on the server and returns a handle, which can be used for reading or writing, then runs the function and closes the handle when finished. Raises when the operation fails.

Functions

Link to this function

open_file(conn, path, modes)

View Source
@spec open_file(SFTPClient.Conn.t(), Path.t(), [SFTPClient.access_mode()]) ::
  {:ok, SFTPClient.Handle.t()} | {:error, SFTPClient.error()}

Opens a file on the server and returns a handle, which can be used for reading or writing.

Link to this function

open_file(conn, path, modes, fun)

View Source
@spec open_file(
  SFTPClient.Conn.t(),
  Path.t(),
  [SFTPClient.access_mode()],
  (SFTPClient.Handle.t() -> res)
) :: {:ok, res} | {:error, SFTPClient.error()}
when res: var

Opens a file on the server and returns a handle, which can be used for reading or writing, then runs the function and closes the handle when finished.

Link to this function

open_file!(conn, path, modes)

View Source

Opens a file on the server and returns a handle, which can be used for reading or writing. Raises when the operation fails.

Link to this function

open_file!(conn, path, modes, fun)

View Source
@spec open_file!(
  SFTPClient.Conn.t(),
  Path.t(),
  [SFTPClient.access_mode()],
  (SFTPClient.Handle.t() -> res)
) :: res | no_return()
when res: var

Opens a file on the server and returns a handle, which can be used for reading or writing, then runs the function and closes the handle when finished. Raises when the operation fails.