aws_s3_client 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 87

AWS_S3_client #

Client library to interact with the AWS S3 API (and other compatible S3 services, such as Yandex Cloud Storage)

Usage #

A simple usage example:

import 'package:aws_s3_client/aws_s3.dart';

main() async {
  Spaces spaces = Spaces(
    region: "region",
    accessKey: "accessKey",
    secretKey: "secretKey",
  );
  for (String name in await spaces.listAllBuckets()) {
    print('bucket: ${name}');
    if (name == 'yourBucket') {
      Bucket bucket = spaces.bucket(name);
      await for (BucketContent content
          in bucket.listContents(prefix: 'test')) {
        print('key: ${content.key}; size: ${content.size}');
      }
    }
  }
  Bucket bucket = spaces.bucket('yourBucket');

  String etag = await bucket.uploadFile(
      'test/test.md', 'README.md', 'text/plain', Permissions.public);
  print('upload: $etag');

  print('done');
}

For more usage examples please see tests

References #

Thanks https://github.com/nbspou for inspiration of creating this package

0.1.1 #

  • Remove all warnings of pub.dev

0.1.0 #

  • Initial version

example/example.dart

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

main() async {
  Spaces spaces = Spaces(
    region: "region",
    accessKey: "accessKey",
    secretKey: "secretKey",
  );
  for (String name in await spaces.listAllBuckets()) {
    print('bucket: ${name}');
    if (name == 'yourBucket') {
      Bucket bucket = spaces.bucket(name);
      await for (BucketContent content in bucket.listContent(prefix: 'test')) {
        print('key: ${content.key}; size: ${content.size}');
      }
    }
  }
  Bucket bucket = spaces.bucket('yourBucket');

  File file = File('README.md');

  String etag = await bucket.uploadFile(
      'test/test.md', file.readAsBytesSync(), 'text/plain', Permissions.public);
  print('upload: $etag');

  print('done');
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  aws_s3_client: ^0.1.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:aws_s3_client/aws_s3_client.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
78
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
87
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14

Analysis suggestions

Package not compatible with runtime flutter-web on web

Because:

  • package:aws_s3_client/aws_s3_client.dart that imports:
  • package:aws_s3_client/src/bucket.dart that imports:
  • package:aws_s3_client/src/stream_transformers.dart that imports:
  • package:aws_s3_client/src/client.dart that imports:
  • package:http_client/console.dart that imports:
  • dart:io

Package not compatible with runtime js

Because:

  • package:aws_s3_client/aws_s3_client.dart that imports:
  • package:aws_s3_client/src/bucket.dart that imports:
  • package:aws_s3_client/src/stream_transformers.dart that imports:
  • package:aws_s3_client/src/client.dart that imports:
  • package:http_client/console.dart that imports:
  • dart:io

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (xml).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
crypto ^2.0.6 2.1.5
http ^0.12.0+2 0.12.1
http_client ^1.0.3 1.4.0
meta ^1.1.7 1.2.2 1.3.0-nullsafety
mime ^0.9.6 0.9.6+3
path ^1.6.4 1.7.0
xml ^3.5.0 3.7.0 4.2.0
Transitive dependencies
buffer 1.0.7
charcode 1.1.3
collection 1.14.13 1.15.0-nullsafety
convert 2.1.1
executor 2.2.1
http_parser 3.1.4
pedantic 1.9.2
petitparser 3.0.4
source_span 1.7.0
stack_trace 1.9.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0 1.3.0-nullsafety
Dev dependencies
test ^1.0.0