ftpclient
ftpclient
A tiny FTP client for Crystal.
Installation
Add this to your shard.yml:
dependencies:
ftpclient:
github: chrisblunt-codes/ftpclient
Usage
begin
client.connect!
client.login!(USERNAME, PASSWORD)
client.retr(remote_file: FILENAME, local_file: "#{DOWNLOAD_DIR}/#{FILENAME}", resume: true)
rescue ex : FtpClient::DownloadError
puts "ERROR: #{ex.message}"
ensure
client.close
end
Examples and Local Testing
The examples/ folder contains code snippets demonstrating how to use the main features of this library (connect, login, download, etc.).
For local testing, you can spin up a simple FTP server using pyftpdlib:
pip install pyftpdlib
python3 -m pyftpdlib -p 2121 -w --user test --password secret --directory /var/tmp/ftp
If you want to simulate slow or laggy connections, you can run the client through Speedbump
speedbump --latency=2000ms --port=2000 127.0.0.1:2121
Roadmap
MUST
- Add parsing for
LISTcommand output to extract file metadata (name, size, date, permissions). - Implement
SIZEcommand to fetch remote file size and show percentage - Implement
STORcommand to upload files. - Add FTPS support using TLS/SSL for secure control and data connections.
- Write unit tests for FTP client functions using Crystal spec.
COULD
- Implement active mode using
PORTcommand for data connections as an alternative toPASV. - Add
MKDcommand to create directories on the FTP server. - Enhance logging with levels (debug, info, error) and file rotation.
SHOULD
- Implement resume for uploads using
APPEcommand. - Implement
DELEcommand to delete files on the FTP server.
WONT
- Build a CLI for user commands (connect, login, list, download, upload, cd) with argument parsing.
- Add ASCII progress bar for download/upload operations.
- Support loading server details from a YAML/JSON config file.
- Implement concurrent file transfers using Crystal fibers.
These features wont be included in version 1.0.0
Contributing
- Fork it (https://github.com/chrisblunt-codes/ftpclient/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Chris Blunt - creator and maintainer
License
Copyright 2025 Chris Blunt Licensed under the MIT License SPDX-License-Identifier: MIT
Repository
ftpclient
Owner
Statistic
- 0
- 0
- 0
- 0
- 0
- 2 months ago
- September 17, 2025
License
MIT License
Links
Synced at
Thu, 20 Nov 2025 20:52:59 GMT
Languages