cloudflare_r2_uploader 1.0.0 copy "cloudflare_r2_uploader: ^1.0.0" to clipboard
cloudflare_r2_uploader: ^1.0.0 copied to clipboard

A Dart package for uploading files to Cloudflare R2 using AWS Signature Version 4. Supports progress tracking, automatic MIME detection, and returns the uploaded file URL.

example/cloudflare_r2_uploader_example.dart

import 'dart:io';
import 'package:cloudflare_r2_uploader/cloudflare_r2_uploader.dart';

void main() async {
  final uploader = CloudflareR2Uploader(
    accountId: 'your-account-id',
    accessKeyId: 'your-access-key',
    secretAccessKey: 'your-secret-access-key',
    bucketName: 'your-bucket',
  );

  final fileBytes = await File('example.jpg').readAsBytes();

  final url = await uploader.uploadFile(
    fileBytes: fileBytes,
    fileName: 'example.jpg',
    folderName: 'uploads',
    onProgress: (progress) =>
        print('Upload Progress: ${(progress * 100).toStringAsFixed(0)}%'),
  );

  if (url != null) {
    print('✅ File uploaded successfully: $url');
  } else {
    print('❌ Upload failed');
  }
}
3
likes
150
points
25
downloads

Publisher

verified publishersaiashirwad.com

Weekly Downloads

A Dart package for uploading files to Cloudflare R2 using AWS Signature Version 4. Supports progress tracking, automatic MIME detection, and returns the uploaded file URL.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

crypto, http, mime

More

Packages that depend on cloudflare_r2_uploader