View Source trooper_scp (trooper v0.5.0)

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

file_handler/0

-opaque file_handler()

mode/0

-type mode() :: [read | write | append | binary | raw].

reason/0

-type reason() :: atom().

Functions

close(File_handler)

-spec close(file_handler()) -> ok | {error, reason()}.

Closes the handler.

del_dir(Trooper, Name)

-spec del_dir(trooper_ssh:trooper_ssh(), Name :: string()) -> ok | {error, reason()}.

Removes a remote directory.

delete(Trooper, Name)

-spec delete(trooper_ssh:trooper_ssh(), Name :: string()) -> ok | {error, reason()}.

Deletes a remote file.

list_dir(Trooper, Path)

-spec list_dir(trooper_ssh:trooper_ssh(), Path :: string()) -> {ok, [string()]} | {error, reason()}.

List remote directory.

make_dir(Trooper, Name)

-spec make_dir(trooper_ssh:trooper_ssh(), Name :: string()) -> ok | {error, reason()}.

Creates a remote directory.

make_symlink(Trooper, Name, Target)

-spec make_symlink(trooper_ssh:trooper_ssh(), Name :: string(), Target :: string()) ->
                      ok | {error, reason()}.

Makes a symlink in the a remote server.

open(File_handler, Name, Mode)

-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.

read(File_handler, Len)

-spec read(file_handler(), Len :: pos_integer()) -> {ok, binary()} | eof | {ok, reason()}.

Reads information from an opened remote file.

read_file(Trooper, Name)

-spec read_file(trooper_ssh:trooper_ssh(), Name :: string()) -> {ok, binary()} | {error, reason()}.

Reads a remote file content.

rename(Trooper, OldName, NewName)

-spec rename(trooper_ssh:trooper_ssh(), OldName :: string(), NewName :: string()) ->
                ok | {error, reason()}.

Renames a remote file.

write(File_handler, Data)

-spec write(file_handler(), Data :: iolist()) -> ok | {error, reason()}.

Writes information to an opened remote file.

write_file(Trooper, Name, Content)

-spec write_file(trooper_ssh:trooper_ssh(), Name :: string(), Content :: iolist()) ->
                    ok | {error, reason()}.

Writes a remote file content.