element.version === currentVersion)) { versionNodes.unshift({ version: currentVersion, url: "#" }); } document.querySelector("#project-version").innerHTML = versionNodes.reduce( (acc, element) => { const status = currentVersion === element.version ? "selected disabled" : ""; return ` ${acc} `; }, `
ftpasta · v0.3.1

FTPasta

Package Version Hex Docs

A simple to use wrapper around Erlang’s built-in ftp module.

Example Usage

gleam add ftpasta
import ftpasta
import ftpasta/tls_config
import gleam/io
import gleam/list

pub fn main() {
  // Connect to a server.
  let assert Ok(connection) =
    ftpasta.new("ftp.gnu.org")
    |> ftpasta.encryption(tls_config.Plaintext)
    |> ftpasta.connect()

  // List the files.
  let assert Ok(items) = ftpasta.list(connection, "")
  list.map(items, fn(item) { io.println(item.name) })

  // Close the connection.
  ftpasta.close(connection)
}

Limitations

The Erlang SSL module doesn’t support verifying self-signed certificates. To connect to a server using a self-signed cert use the verification(False) option when creation the connection.

Related Projects

  • gftp - An FTP client written entirely in Gleam.
  • gleam-ftp - An FTP server written in Gleam.

Development

The included script run_tests.sh will start two instances of vsftpd with the required configuration, run all tests, and then shut the servers down.

Search Document