minio_flutter

Creator: coderz1093

Last updated:

0 purchases

minio_flutter Image
minio_flutter Images
Add to Cart

Description:

minio flutter

minio_flutter #
Unofficial MinIO Dart Client SDK that provides simple APIs to access any Amazon S3 compatible object storage server.
Initialize #
MinIO
Minio.init(
endPoint: 'play.min.io',
accessKey: 'Q3AM3UQ867SPQQA43P2F',
secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
region: 'us-east-1',
);
copied to clipboard
AWS S3
Minio.init(
endPoint: 's3.amazonaws.com',
accessKey: 'YOUR-ACCESSKEYID',
secretKey: 'YOUR-SECRETACCESSKEY',
region: 'us-east-1',
);
copied to clipboard
Filebase
Minio.init(
endPoint: 's3.filebase.com',
accessKey: 'YOUR-ACCESSKEYID',
secretKey: 'YOUR-SECRETACCESSKEY',
useSSL: true,
);
copied to clipboard
File upload
import 'package:minio_flutter/io.dart';
import 'package:minio_flutter/minio.dart';

void main() async {
Minio.init(
endPoint: 'play.min.io',
accessKey: 'Q3AM3UQ867SPQQA43P2F',
secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
);

await Minio.shared.fPutObject('mybucket', 'myobject', 'path/to/file');
}
copied to clipboard
For complete example, see: [example]

To use fPutObject() and fGetObject, you have to import 'package:minio/io.dart';

Upload with progress
import 'package:minio_flutter/minio.dart';

void main() async {
Minio.init(
endPoint: 'play.min.io',
accessKey: 'Q3AM3UQ867SPQQA43P2F',
secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
);

await Minio.shared.putObject(
'mybucket',
'myobject',
Stream<Uint8List>.value(Uint8List(1024)),
onProgress: (bytes) => print('$bytes uploaded'),
);
}
copied to clipboard
Get object
import 'dart:io';
import 'package:minio_flutter/minio.dart';

void main() async {
Minio.init(
endPoint: 's3.amazonaws.com',
accessKey: 'YOUR-ACCESSKEYID',
secretKey: 'YOUR-SECRETACCESSKEY',
);

final stream = await Minio.shared.getObject('BUCKET-NAME', 'OBJECT-NAME');

// Get object length
print(stream.contentLength);

// Write object data stream to file
await stream.pipe(File('output.txt').openWrite());
}
copied to clipboard
License #
MIT

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.