aws_interop 2.0.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 64

s3_dart

Dart wrapper for Amazon AWS.

Some additional type information has been added to the .d.ts file on an as-needed basis.

Usage

see the example/ directory

Generating the library

dart_js_facade_gen lib/aws-sdk.d.ts > lib/aws_sdk.dart

Note: The committed version of this library differs from the dart_js_facade_gen output. This is necessary until https://github.com/dart-lang/js_facade_gen/issues/20 is resolved.

The .min.js file

the .min.js file has been created by running UglifyJS due to Uint8List bugs with the packaged .min.js file.

Known Issues

Loading objects from the S3 API with newer versions, or the minified version of 2.4.13 of the JS library will not return a Uint8List in non-Dartium browsers.

Features and bugs

Please file feature requests and bugs at the issue tracker.

Changelog

1.0.0

  • Initial version

example/main.dart

@JS()
library apptreeTest;

import 'package:aws_interop/aws_sdk.dart' as aws;
import 'dart:async';
import 'dart:html';
import 'package:js/js.dart';
import 'package:jsifier/jsifier.dart';
import 'dart:convert';

Future main() async {
  var accessKey = '';
  var secretKey = '';
  var region = '';
  var bucketName = '';

  aws.config.credentials = new aws.Credentials(accessKey, secretKey);
  aws.config.region = region;

  var params = {'Bucket': bucketName, 'Key': ''};
  var options = {'params': params};
  var bucket = new aws.S3(options);
  var uploadFileBtn = querySelector('#uploadFileBtn');

  uploadFileBtn.onClick.listen((evt) async {
    var key = (querySelector('#fileName') as InputElement).value;
    var request = new aws.PutObjectRequest();
    request.Body = await getFileBody();
    request.Key = key;
    request.Bucket = bucketName;
    bucket.putObject(request, allowInterop((err, data) {
      print('error: $err');
      print('data: $data');
    }));
  });

  var getFileButton = querySelector('#getFileBtn');
  getFileButton.onClick.listen((evt) {
    var request = new aws.GetObjectRequest();
    var key = (querySelector('#fileName') as InputElement).value;
    request.Key = key;
    request.Bucket = bucketName;
    bucket.getObject(request, allowInterop((err, data) {
      var obj = Jsifier.decode(data);
      print('content-type: ${obj["ContentType"]}');
      print('data length: ${obj["Body"]["length"]}');
    }));
  });

  var deleteFileButton = querySelector('#deleteFileBtn');
  deleteFileButton.onClick.listen((evt) {
    var key = (querySelector('#fileName') as InputElement).value;
    var request = new aws.DeleteObjectRequest();
    request.Key = key;
    request.Bucket = bucketName;
    bucket.deleteObject(request, allowInterop((err, data) {
      if (err != null) {
        print('error deleting file: $err');
        return;
      }
      print('deleted file $key');
    }));
  });
}

Future<List<int>> getFileBody() async {
  var uploadInput = querySelector('#fileUpload');
  final files = uploadInput.files;
  if (files.length == 1) {
    final file = files[0];
    final reader = new FileReader();
    var onDone = reader.onLoadEnd.first;
    reader.readAsDataUrl(file);
    await onDone;
    var upload = reader.result.toString().split(',').elementAt(1);
    return BASE64.decode(upload);
  }
  return null;
}

1. Depend on it

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


dependencies:
  aws_interop: "^2.0.1"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support 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_interop/aws_sdk.dart';
        
Version Uploaded Documentation Archive
2.0.1 Nov 3, 2016 Go to the documentation of aws_interop 2.0.1 Download aws_interop 2.0.1 archive
2.0.0 Oct 19, 2016 Go to the documentation of aws_interop 2.0.0 Download aws_interop 2.0.0 archive
1.2.0 Sep 1, 2016 Go to the documentation of aws_interop 1.2.0 Download aws_interop 1.2.0 archive
1.1.0 Aug 29, 2016 Go to the documentation of aws_interop 1.1.0 Download aws_interop 1.1.0 archive
1.0.1 Aug 9, 2016 Go to the documentation of aws_interop 1.0.1 Download aws_interop 1.0.1 archive
1.0.0 Aug 9, 2016 Go to the documentation of aws_interop 1.0.0 Download aws_interop 1.0.0 archive

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 3, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
38 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
75 / 100
Overall score:
Weighted score of the above. [more]
64

Platforms

Detected platforms: web, other

Platform components identified in package: js.

Suggestions

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0
func >=0.1.0 <1.0.0 0.1.1 1.0.0
js >=0.6.0 <1.0.0 0.6.1
Dev dependencies
browser >=0.10.0 <0.11.0
jsifier any
test >=0.12.0 <0.13.0