Deletes a directory specified by .
@@ -192,7 +200,7 @@
list_dir(ChannelPid, Path) ->
- list_dir(ChannelPid, Path, Timeout) -> {ok, Filenames} | {error, Reason}
+ list_dir(ChannelPid, Path, Timeout) -> {ok, Filenames} | {error, reason()}
Lists the directory.
ChannelPid = pid()
@@ -200,7 +208,6 @@
Filenames = [Filename]
Filename = string()
Timeout = timeout()
- Reason = term()
Lists the given directory on the server, returning the
@@ -210,13 +217,12 @@
make_dir(ChannelPid, Name) ->
- make_dir(ChannelPid, Name, Timeout) -> ok | {error, Reason}
+ make_dir(ChannelPid, Name, Timeout) -> ok | {error, reason()}
Creates a directory.
ChannelPid = pid()
Name = string()
Timeout = timeout()
- Reason = term()
Creates a directory specified by .
@@ -227,24 +233,23 @@
make_symlink(ChannelPid, Name, Target) ->
- make_symlink(ChannelPid, Name, Target, Timeout) -> ok | {error, Reason}
+ make_symlink(ChannelPid, Name, Target, Timeout) -> ok | {error, reason()}
Creates a symbolic link.
ChannelPid = pid()
Name = string()
Target = string()
- Reason = term()
Creates a symbolic link pointing to with the
- name , like
- file:make_symlink/2
+ name .
+
open(ChannelPid, File, Mode) ->
- open(ChannelPid, File, Mode, Timeout) -> {ok, Handle} | {error, Reason}
+ open(ChannelPid, File, Mode, Timeout) -> {ok, Handle} | {error, reason()}
Opens a file and returns a handle.
ChannelPid = pid()
@@ -253,7 +258,6 @@
Modeflag = read | write | creat | trunc | append | binary
Timeout = timeout()
Handle = term()
- Reason = term()
Opens a file on the server and returns a handle, which
@@ -262,13 +266,12 @@
opendir(ChannelPid, Path) ->
- opendir(ChannelPid, Path, Timeout) -> {ok, Handle} | {error, Reason}
+ opendir(ChannelPid, Path, Timeout) -> {ok, Handle} | {error, reason()}
Opens a directory and returns a handle.
ChannelPid = pid()
Path = string()
Timeout = timeout()
- Reason = term()
Opens a handle to a directory on the server. The handle
@@ -278,7 +281,7 @@
open_tar(ChannelPid, Path, Mode) ->
- open_tar(ChannelPid, Path, Mode, Timeout) -> {ok, Handle} | {error, Reason}
+ open_tar(ChannelPid, Path, Mode, Timeout) -> {ok, Handle} | {error, reason()}
Opens a tar file on the server to which ChannelPid
is connected and returns a handle.
@@ -298,7 +301,6 @@
DecryptResult = {ok,PlainBin,CryptoState} | {ok,PlainBin,CryptoState,ChunkSize}
CloseFun = (fun(PlainBin,CryptoState) -> {ok,EncryptedBin})
Timeout = timeout()
- Reason = term()
Opens a handle to a tar file on the server, associated with ChannelPid.
@@ -333,7 +335,7 @@
position(ChannelPid, Handle, Location) ->
- position(ChannelPid, Handle, Location, Timeout) -> {ok, NewPosition} | {error, Reason}
+ position(ChannelPid, Handle, Location, Timeout) -> {ok, NewPosition | {error, reason()}
Sets the file position of a file.
ChannelPid = pid()
@@ -343,12 +345,11 @@
Offset = integer()
Timeout = timeout()
NewPosition = integer()
- Reason = term()
Sets the file position of the file referenced by .
Returns (as an absolute offset) if
- successful, otherwise . is
+ successful, otherwise . is
one of the following:
@@ -379,7 +380,7 @@
pread(ChannelPid, Handle, Position, Len) ->
- pread(ChannelPid, Handle, Position, Len, Timeout) -> {ok, Data} | eof | {error, Error}
+ pread(ChannelPid, Handle, Position, Len, Timeout) -> {ok, Data} | eof | {error, reason()}
Reads from an open file.
ChannelPid = pid()
@@ -388,7 +389,6 @@
Len = integer()
Timeout = timeout()
Data = string() | binary()
- Reason = term()
The function reads from a specified position,
@@ -399,7 +399,7 @@
pwrite(ChannelPid, Handle, Position, Data) -> ok
- pwrite(ChannelPid, Handle, Position, Data, Timeout) -> ok | {error, Reason}
+ pwrite(ChannelPid, Handle, Position, Data, Timeout) -> ok | {error, reason()}
Writes to an open file.
ChannelPid = pid()
@@ -407,7 +407,6 @@
Position = integer()
Data = iolist()
Timeout = timeout()
- Reason = term()
The function writes to a specified position,
@@ -419,7 +418,7 @@
read(ChannelPid, Handle, Len) ->
- read(ChannelPid, Handle, Len, Timeout) -> {ok, Data} | eof | {error, Error}
+ read(ChannelPid, Handle, Len, Timeout) -> {ok, Data} | eof | {error, reason()}
Reads from an open file.
ChannelPid = pid()
@@ -428,12 +427,11 @@
Len = integer()
Timeout = timeout()
Data = string() | binary()
- Reason = term()
Reads bytes from the file referenced by
. Returns , , or
- . If the file is opened with ,
+ . If the file is opened with ,
is a binary, otherwise it is a string.
If the file is read past eof, only the remaining bytes
are read and returned. If no bytes are read,
@@ -443,25 +441,22 @@
read_file(ChannelPid, File) ->
- read_file(ChannelPid, File, Timeout) -> {ok, Data} | {error, Reason}
+ read_file(ChannelPid, File, Timeout) -> {ok, Data} | {error, reason()}
Reads a file.
ChannelPid = pid()
File = string()
Data = binary()
Timeout = timeout()
- Reason = term()
- Reads a file from the server, and returns the data in a binary,
- like
- file:read_file/1
+ Reads a file from the server, and returns the data in a binary.
read_file_info(ChannelPid, Name) ->
- read_file_info(ChannelPid, Name, Timeout) -> {ok, FileInfo} | {error, Reason}
+ read_file_info(ChannelPid, Name, Timeout) -> {ok, FileInfo} | {error, reason()}
Gets information about a file.
ChannelPid = pid()
@@ -469,35 +464,34 @@
Handle = term()
Timeout = timeout()
FileInfo = record()
- Reason = term()
Returns a record from the file specified by
- or ,
- like file:read_file_info/2
+ or . See
+ file:read_file_info/2
+ for information about the record.
+
read_link(ChannelPid, Name) ->
- read_link(ChannelPid, Name, Timeout) -> {ok, Target} | {error, Reason}
+ read_link(ChannelPid, Name, Timeout) -> {ok, Target} | {error, reason()}
Reads symbolic link.
ChannelPid = pid()
Name = string()
Target = string()
- Reason = term()
- Reads the link target from the symbolic link specified
- by , like
- file:read_link/1
+ Reads the link target from the symbolic link specified by .
+
- read_link_info(ChannelPid, Name) -> {ok, FileInfo} | {error, Reason}
- read_link_info(ChannelPid, Name, Timeout) -> {ok, FileInfo} | {error, Reason}
+ read_link_info(ChannelPid, Name) -> {ok, FileInfo} | {error, reason()}
+ read_link_info(ChannelPid, Name, Timeout) -> {ok, FileInfo} | {error, reason()}
Gets information about a symbolic link.
ChannelPid = pid()
@@ -505,30 +499,31 @@
Handle = term()
Timeout = timeout()
FileInfo = record()
- Reason = term()
Returns a record from the symbolic
- link specified by or , like
- file:read_link_info/2
+ link specified by or .
+ See
+ file:read_link_info/2
+ for information about the record.
+
rename(ChannelPid, OldName, NewName) ->
- rename(ChannelPid, OldName, NewName, Timeout) -> ok | {error, Reason}
+ rename(ChannelPid, OldName, NewName, Timeout) -> ok | {error, reason()}
Renames a file.
ChannelPid = pid()
OldName = string()
NewName = string()
Timeout = timeout()
- Reason = term()
Renames a file named and gives it the name
- , like
- file:rename/2
+ .
+
@@ -537,14 +532,13 @@
start_channel(ConnectionRef, Options) ->
start_channel(Host, Options) ->
start_channel(Host, Port, Options) -> {ok, Pid} | {ok, Pid, ConnectionRef} |
- {error, Reason}
+ {error, reason()|term()}
Starts an SFTP client.
Host = string()
ConnectionRef = ssh_connection_ref()
Port = integer()
Options = [{Option, Value}]
- Reason = term()
If no connection reference is provided, a connection is set
@@ -592,7 +586,7 @@
write(ChannelPid, Handle, Data) ->
- write(ChannelPid, Handle, Data, Timeout) -> ok | {error, Reason}
+ write(ChannelPid, Handle, Data, Timeout) -> ok | {error, reason()}
Writes to an open file.
ChannelPid = pid()
@@ -600,61 +594,47 @@
Position = integer()
Data = iolist()
Timeout = timeout()
- Reason = term()
Writes to the file referenced by .
The file is to be opened with or
- flag. Returns if successful or
+ flag. Returns if successful or
otherwise.
- Typical error reasons:
-
-
- -
-
File is not opened for writing.
-
-
- -
-
No space is left on the device.
-
-
write_file(ChannelPid, File, Iolist) ->
- write_file(ChannelPid, File, Iolist, Timeout) -> ok | {error, Reason}
+ write_file(ChannelPid, File, Iolist, Timeout) -> ok | {error, reason()}
Writes a file.
ChannelPid = pid()
File = string()
Iolist = iolist()
Timeout = timeout()
- Reason = term()
- Writes a file to the server, like file:write_file/2 The
- file is created if it does not exist. The file is overwritten
- if it exists.
+ Writes a file to the server. The file is created if it does not exist
+ but overwritten if it exists.
write_file_info(ChannelPid, Name, Info) ->
- write_file_info(ChannelPid, Name, Info, Timeout) -> ok | {error, Reason}
+ write_file_info(ChannelPid, Name, Info, Timeout) -> ok | {error, reason()}
Writes information for a file.
ChannelPid = pid()
Name = string()
Info = record()
Timeout = timeout()
- Reason = term()
Writes file information from a record to the
- file specified by , like
- file:write_file_info/[2,3]
+ file specified by . See
+ file:write_file_info/[2,3]
+ for information about the record.
+