buxing

Creator: coderz1093

Last updated:

0 purchases

buxing Image
buxing Images
Add to Cart

Description:

buxing

An HTTP file downloader packed with many features -> resumable downloads, multiple connections, buffering, auto-retry, etc.
Features #

Resumable downloads.
Supports multiple connections.
Auto buffering for less disk writes.
Auto HTTP connection retry via the builtin RetryClient.

Usage #
Install and import this package:
import 'package:buxing/buxing.dart';
copied to clipboard
A simple task #
void main() async {
var task = Task(
Uri.parse('https://golang.org/dl/go1.17.3.src.tar.gz'), 'go1.17.3.src.tar.gz');
await task.start();
}
copied to clipboard
Progress reporting #
Progress events are raised through Task.onProgress:
task.onProgress = (prog) => print(prog.transferred / prog.total);
copied to clipboard
Multiple connections #
To enable multiple connections, set the optional worker param in constructor and pass a ParallelWorker.
var task = Task(Uri.parse('https://golang.org/dl/go1.17.3.src.tar.gz'),
'go1.17.3.src.tar.gz',
worker: ParallelWorker()); // A `ParallelWorker` enables multiple connections.
copied to clipboard
By default ParallelWorker manages concurrency by itself, you can explicitly set the number of concurrent connections:
ParallelWorker(concurrency: 10)
copied to clipboard
Buffer size #

The defaults are, 200 KB for a single-connection task, 50 KB per connection for a multi-connection task.

To set the buffer size:
// Single-connection task
var task = Task(Uri.parse('URL'), 'FILE',
worker: Worker(bufferSize: 100000)); // 100 KB

// Multi-connection task.
var task = Task(Uri.parse('URL'), 'FILE',
worker: ParallelWorker(bufferSize: 100000)); // 100 KB
copied to clipboard
Logging #
To enable logging, set the logger field:
var task = Task(Uri.parse('https://golang.org/dl/go1.17.3.src.tar.gz'),
'downloads/go1.17.3.src.tar.gz',
logger: Logger(level: LogLevel.info));
copied to clipboard
Log levels:
enum LogLevel { verbose, info, warning, error }
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.