https://github.com/insign/dart_dloader
A simple and versatile library for downloading files with support for adapters including dio, curl, wget, powershell, aria2 and axel. Feel free to create new adapters.
https://github.com/insign/dart_dloader
dart download downloader
Last synced: 10 months ago
JSON representation
A simple and versatile library for downloading files with support for adapters including dio, curl, wget, powershell, aria2 and axel. Feel free to create new adapters.
- Host: GitHub
- URL: https://github.com/insign/dart_dloader
- Owner: insign
- License: bsd-3-clause
- Created: 2023-01-30T16:25:37.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-20T09:53:03.000Z (over 2 years ago)
- Last Synced: 2024-11-16T13:09:22.846Z (over 1 year ago)
- Topics: dart, download, downloader
- Language: Dart
- Homepage: https://pub.dev/packages/dloader
- Size: 46.9 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
A simple and versatile library for downloading files with support for adapters including dio, curl, wget, powershell, aria2 and axel. Feel free to create new adapters.
## Getting started
```dart
dart pub add dloader
```
## Usage
```dart
import 'dart:io';
import 'package:dloader/dloader.dart';
void main() {
final dloader = Dloader(CurlAdapter());
final url = 'https://example.com/file.zip';
final destination = File('/path/to/file.zip');
dloader
.download(
url: url,
destination: destination,
onProgress: (progress) {
print('Percent complete: ${progress['percentComplete']}%');
print('Bytes downloaded: ${progress['downloaded']}');
print('Bytes total size: ${progress['totalSize']}');
print('Speed: ${progress['speed']}');
print('Time remaining: ${progress['timeRemaining']}');
})
.then((File file) {
print('File downloaded to: ${file.path}');
}).catchError((e) {
print('Error downloading file: $e');
});
}
```
## LICENSE
[BSD 3-Clause License](./LICENSE)
## CONTRIBUTE
If you have an idea for a new feature or have found a bug, just do a pull request (PR).