ftpasta
Types
Configuration struct for building FTP connections.
pub type Config {
Config(
host: String,
port: Int,
tls: TLSConfig,
username: String,
password: String,
)
}
Constructors
-
Config( host: String, port: Int, tls: TLSConfig, username: String, password: String, )
Type representing an FTP connection.
pub opaque type Connection
Functions
pub fn append_bytes(
connection: Connection,
data: BitArray,
remote_file: String,
) -> Result(Nil, FTPError)
Append some data onto a file on the server.
pub fn append_file(
connection: Connection,
local_file: String,
remote_file: String,
) -> Result(Nil, FTPError)
Append a file to another file on the server.
pub fn auth(
config: Config,
username: String,
password: String,
) -> Config
Provide a username and password.
pub fn change_working_dir(
connection: Connection,
remote_dir: String,
) -> Result(Nil, FTPError)
Change directories on the remote server.
pub fn create_dir(
connection: Connection,
remote_dir: String,
) -> Result(Nil, FTPError)
Create a new directory on the server.
pub fn delete_dir(
connection: Connection,
remote_dir: String,
) -> Result(Nil, FTPError)
Remove an empty directory from the server.
pub fn delete_file(
connection: Connection,
remote_file: String,
) -> Result(Nil, FTPError)
Remove a file from the server.
pub fn delete_recursive(
connection: Connection,
remote_dir: String,
) -> Result(Nil, FTPError)
Remove a directory and all contents from the server.
pub fn describe_error(error: FTPError) -> String
Convert an FTPError into a descriptive string.
pub fn download_bytes(
connection: Connection,
remote_file: String,
) -> Result(BitArray, FTPError)
Fetch a file from the server, and return it as a BitArray.
pub fn download_file(
connection: Connection,
remote_file: String,
local_file: String,
) -> Result(Nil, FTPError)
Fetch a file from the server.
pub fn download_recursive(
connection: Connection,
remote_dir: String,
local_dir: String,
) -> Result(Nil, FTPError)
Fetch a directory and all contents recursively from the server.
pub fn get_working_dir(
connection: Connection,
) -> Result(String, FTPError)
Get the current remote path used for the connection.
pub fn list(
connection: Connection,
remote_dir: String,
) -> Result(List(Listing), FTPError)
List all files, symlinks, and subdirectories in a directory.
pub fn rename(
connection: Connection,
old_path: String,
new_path: String,
) -> Result(Nil, FTPError)
Rename a file or directory on the server.
pub fn upload_bytes(
connection: Connection,
data: BitArray,
remote_file: String,
) -> Result(Nil, FTPError)
Send a data in memory to the server.
pub fn upload_file(
connection: Connection,
local_file: String,
remote_file: String,
) -> Result(Nil, FTPError)
Send a file to the server.
pub fn upload_recursive(
connection: Connection,
local_dir: String,
remote_dir: String,
) -> Result(Nil, FTPError)
Send a directory and all contents to the server.