View Source trooper_scp (trooper v0.4.2)
Trooper SCP is in charge of handle remote/local files copy.
You need to have a trooper SSH connection opened to list remote files, upload local files to the remote place or download remote files.
Summary
Functions
Closes the handler.
Removes a remote directory.
Deletes a remote file.
List remote directory.
Creates a remote directory.
Makes a symlink in the a remote server.
Opens a remote file using a handler to let use read and write. Depending on the mode in use.
Reads information from an opened remote file.
Reads a remote file content.
Renames a remote file.
Writes information to an opened remote file.
Writes a remote file content.
Types
-opaque file_handler()
-type mode() :: [read | write | append | binary | raw].
-type reason() :: atom().
Functions
-spec close(file_handler()) -> ok | {error, reason()}.
Closes the handler.
-spec del_dir(trooper_ssh:trooper_ssh(), Name :: string()) -> ok | {error, reason()}.
Removes a remote directory.
-spec delete(trooper_ssh:trooper_ssh(), Name :: string()) -> ok | {error, reason()}.
Deletes a remote file.
-spec list_dir(trooper_ssh:trooper_ssh(), Path :: string()) -> {ok, [string()]} | {error, reason()}.
List remote directory.
-spec make_dir(trooper_ssh:trooper_ssh(), Name :: string()) -> ok | {error, reason()}.
Creates a remote directory.
-spec make_symlink(trooper_ssh:trooper_ssh(), Name :: string(), Target :: string()) -> ok | {error, reason()}.
Makes a symlink in the a remote server.
-spec open(file_handler(), Name :: string(), Mode :: mode()) -> {ok, file_handler()} | {error, reason()}.
Opens a remote file using a handler to let use read and write. Depending on the mode in use.
-spec read(file_handler(), Len :: pos_integer()) -> {ok, binary()} | eof | {ok, reason()}.
Reads information from an opened remote file.
-spec read_file(trooper_ssh:trooper_ssh(), Name :: string()) -> {ok, binary()} | {error, reason()}.
Reads a remote file content.
-spec rename(trooper_ssh:trooper_ssh(), OldName :: string(), NewName :: string()) -> ok | {error, reason()}.
Renames a remote file.
-spec write(file_handler(), Data :: iolist()) -> ok | {error, reason()}.
Writes information to an opened remote file.
-spec write_file(trooper_ssh:trooper_ssh(), Name :: string(), Content :: iolist()) -> ok | {error, reason()}.
Writes a remote file content.