aws_s3_client 0.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 79

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 = new 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.0.1 #

  • Initial version

example/example.dart

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

main() async {
  Spaces spaces = new 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 = new 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.0.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]
80
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
79
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.9+1

Analysis suggestions

Package not compatible with runtime flutter-web of web

Because of the import of dart:io via the import chain package:aws_s3_client/aws_s3_client.dart->package:aws_s3_client/src/bucket.dart->package:aws_s3_client/src/stream_transformers.dart->package:aws_s3_client/src/client.dart->package:http_client/console.dart->dart:io

Package not compatible with runtime web

Because of the import of dart:io via the import chain package:aws_s3_client/aws_s3_client.dart->package:aws_s3_client/src/bucket.dart->package:aws_s3_client/src/stream_transformers.dart->package:aws_s3_client/src/client.dart->package:http_client/console.dart->dart:io

Health suggestions

Fix lib/src/client.dart. (-11.78 points)

Analysis of lib/src/client.dart reported 25 hints, including:

line 41 col 34: Unnecessary new keyword.

line 50 col 9: Unnecessary new keyword.

line 50 col 47: Unnecessary new keyword.

line 53 col 28: Unnecessary new keyword.

line 57 col 13: Unnecessary new keyword.

Fix lib/src/bucket.dart. (-6.31 points)

Analysis of lib/src/bucket.dart reported 13 hints, including:

line 44 col 37: Unnecessary new keyword.

line 92 col 23: Unnecessary new keyword.

line 115 col 21: Unnecessary new keyword.

line 180 col 9: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

line 184 col 9: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

Fix lib/src/stream_transformers.dart. (-2.48 points)

Analysis of lib/src/stream_transformers.dart reported 5 hints:

line 16 col 21: Use = to separate a named parameter from its default value.

line 16 col 50: Use = to separate a named parameter from its default value.

line 31 col 21: Use = to separate a named parameter from its default value.

line 31 col 50: Use = to separate a named parameter from its default value.

line 33 col 19: Unnecessary new keyword.

Fix lib/src/spaces.dart. (-1 points)

Analysis of lib/src/spaces.dart reported 2 hints:

line 42 col 12: Unnecessary new keyword.

line 52 col 24: Unnecessary new keyword.

Format lib/src/exception.dart.

Run dartfmt to format lib/src/exception.dart.

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).

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

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.1.8
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.6
charcode 1.1.3
collection 1.14.12
convert 2.1.1
executor 2.2.1
http_parser 3.1.4
pedantic 1.9.0
petitparser 3.0.4
source_span 1.7.0
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
test ^1.0.0