Skip to content
Snippets Groups Projects
Commit 052a784f authored by xuty's avatar xuty
Browse files

replace ByteStream with MinioByteStream

parent 6528a441
Branches
No related merge requests found
# 2.1.0-pre
- `getObject` now returns `MinioByteStream` with an additional `contentLength` field.
## 2.0.0-pre
- Migrate to NNBD
......
......@@ -65,6 +65,29 @@ For complete example, see: [example]
> To use `fPutObject()` and `fGetObject`, you have to `import 'package:minio/io.dart';`
**Get object**
```dart
import 'dart:io';
import 'package:minio/minio.dart';
void main() async {
final minio = Minio(
endPoint: 's3.amazonaws.com',
accessKey: 'YOUR-ACCESSKEYID',
secretKey: 'YOUR-SECRETACCESSKEY',
);
final stream = await minio.getObject('BUCKET-NAME', 'OBJECT-NAME');
// Get object length
print(stream.contentLength);
// Write object data stream to file
await stream.pipe(File('output.txt').openWrite());
}
```
## Features and bugs
Please file feature requests and bugs at the [issue tracker][tracker].
......
......@@ -2,5 +2,6 @@ library minio;
export 'src/minio.dart';
export 'src/minio_errors.dart';
export 'src/minio_stream.dart';
// TODO: Export any libraries intended for clients of this package.
import 'dart:async';
class MinioByteStream extends StreamView<List<int>> {
MinioByteStream.fromStream({
required Stream<List<int>> stream,
required this.contentLength,
}) : super(stream);
final int? contentLength;
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment