anonfiles 0.7.1 copy "anonfiles: ^0.7.1" to clipboard
anonfiles: ^0.7.1 copied to clipboard

AnonFiles HTTP client. Support for AnonFiles, FileChan and LetsUpload. Large file upload is supported.

example/anonfiles_example.dart

import 'dart:io';
import 'dart:typed_data';

import 'package:anonfiles/anonfiles.dart';

Future<void> useClient(AnonFilesClientBase client) async {
  print('[${client.runtimeType}]');

  final File file = File('data/sample.txt');

  final Stream<Uint8List> byteStream =
      File('data/sample.txt').openRead().map(Uint8List.fromList);

  final int length = file.lengthSync();

  const String filename = 'sample.txt';

  final AnonFileUploadResponse? response = await client.uploadFileBytes(
    byteStream: byteStream,
    filename: filename,
    length: length,
  );

  if (response?.data != null) {
    final String htmlDownloadUrl = response!.htmlDownloadUrl!;

    // URL to open the download page.
    print('HTML download short URL: $htmlDownloadUrl');

    print('[-End-]\n');
  } else {
    // Handle error.
    print('Error: ${response?.error?.message}');
  }
}

void main() async {
  for (final AnonFilesClientBase client in allClients()) {
    await useClient(client);
  }
}
0
likes
125
points
23
downloads

Publisher

verified publisheralexisa.dev

Weekly Downloads

AnonFiles HTTP client. Support for AnonFiles, FileChan and LetsUpload. Large file upload is supported.

Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

Funding

Consider supporting this project:

github.com
donate.alexrintt.io

License

MIT (license)

Dependencies

freezed_annotation, http, json_annotation

More

Packages that depend on anonfiles