README.md

# FTPasta

[![Package Version](https://img.shields.io/hexpm/v/ftpasta)](https://hex.pm/packages/ftpasta)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/ftpasta/)

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

## Example Usage

```sh
gleam add ftpasta
```
```gleam
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](https://github.com/veeso/gftp) - An FTP client written entirely in Gleam.
- [gleam-ftp](https://github.com/raineycat/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.