stream method
return the file as a stream, from any disk.
return await Storage().stream('images/avatar/sample.jpeg');
Implementation
Future<StreamFile> stream(String filename) async {
String key = _key(filename);
Disk target = use();
try {
ObjectMetaData meta = await target.getMetaData(key);
return StreamFile(
ContentType.parse(meta.contentType),
await target.getStream(key),
length: meta.size,
);
} on FileNotFoundException {
throw NotFoundHttpException(message: 'file not found');
}
}