Skip to content

Commit

Permalink
Example, Changelog & ReadMe
Browse files Browse the repository at this point in the history
  • Loading branch information
virtualmarc committed Feb 6, 2020
1 parent 159f125 commit 749fabd
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.1.0

- Initial version
- Connect to an FTP Server with Authorization
- Get current directory
- Change directory
- Make directory
- Delete directory
- Upload file (in binary mode)
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,25 @@ A small and simple FTP Client library for Dart Native.

## Usage

A simple usage example:
Add the following dependency to the pubspec.yaml

```yaml
dependencies:
ftpclient: ^0.1.0
```

How to use the FTP Client:

```dart
import 'dart:io';
import 'package:ftpclient/ftpclient.dart';
main() {
// TODO
FTPClient ftpClient = new FTPClient('example.com', user: 'myname', pass: 'mypass');
ftpClient.connect();
ftpClient.uploadFile(new File('test.zip'));
ftpClient.disconnect();
}
```

For a complete example, see the examples in the example folder!
33 changes: 32 additions & 1 deletion example/ftpclient_example.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
import 'dart:io';

import 'package:ftpclient/ftpclient.dart';

void main() {

// Create Connection
FTPClient ftpClient = new FTPClient('example.com', user: 'myname', pass: 'mypass');

// Connect to FTP Server
ftpClient.connect();

try {
// Create Directory
ftpClient.makeDirectory('test');

// Change Directory
ftpClient.changeDirectory('test');

// Get current Directory
print(ftpClient.currentDirectory());

// Upload File
ftpClient.uploadFile(new File('test.zip'));

// Navigate back
ftpClient.changeDirectory('..');

// Delete Directory
ftpClient.deleteDirectory('test');
} finally {
// Disconnect
ftpClient.disconnect();
}
}

0 comments on commit 749fabd

Please sign in to comment.