chunked_downloader 1.1.0 copy "chunked_downloader: ^1.1.0" to clipboard
chunked_downloader: ^1.1.0 copied to clipboard

A dart package to download files with custom chunk sizes for faster downloads.

Dart downloader that lets you set a custom chunk sizes for a lot faster downloads.

Features #

  • custom chunk size downloads
  • stop downloads
  • pause downloads
  • resume downloads

Getting started #

Add this package to your pubspec.yml:

chunked_downloader: x.x.x

Usage #

You can use it like this: (note that everything is in bytes)

    var chunkedDownloader = await ChunkedDownloader(
        url: 'https://filesamples.com/samples/video/mjpeg/sample_3840x2160.mjpeg',
        saveFilePath: '/tmp/sometestfile.mjpeg',
        chunkSize: 1024 * 1024,
        headers: {'Authorization': 'Bearer token'},
        onError: (error) {},
        onProgress: (received, total, speed) {},
        onDone: (file) {})
    .start();

chunkedDownloader.pause();
chunkedDownloader.resume();
chunkedDownloader.stop();

The download is written to <saveFilePath>.tmp first and only renamed to saveFilePath once it completed, so a cancelled or failed download never leaves a half written file behind.

Releasing #

Pushing a v<version> tag that matches the version in pubspec.yaml runs .github/workflows/publish.yml, which analyzes, tests and dry runs the package before publishing it to pub.dev.

The workflow authenticates with the PUB_CREDENTIALS repository secret — the contents of the local pub-credentials.json written by dart pub login. When the secret is unset it falls back to the pub.dev OIDC token, which needs automated publishing to be configured for the package on pub.dev.

7
likes
160
points
497
downloads

Documentation

API reference

Publisher

verified publisherbostrot.com

Weekly Downloads

A dart package to download files with custom chunk sizes for faster downloads.

Repository (GitHub)
View/report issues

License

GPL-3.0 (license)

Dependencies

async, http

More

Packages that depend on chunked_downloader