diff --git a/lib/src/virtual_directory.dart b/lib/src/virtual_directory.dart index ff2ed4e5..c36a5659 100644 --- a/lib/src/virtual_directory.dart +++ b/lib/src/virtual_directory.dart @@ -1,4 +1,5 @@ import 'dart:async'; +import 'dart:typed_data'; import 'package:angel_framework/angel_framework.dart'; import 'package:file/file.dart'; import 'package:http_parser/http_parser.dart'; @@ -284,7 +285,7 @@ class VirtualDirectory { statusCode: 416, message: '`Range` header may not be empty.'); } else if (header.items.length == 1) { var item = header.items[0]; - Stream> stream; + Stream stream; int len = 0, total = totalFileSize; if (item.start == -1) { @@ -311,7 +312,7 @@ class VirtualDirectory { res.statusCode = 206; res.headers['content-length'] = len.toString(); res.headers['content-range'] = 'bytes ' + item.toContentRange(total); - await stream.pipe(res); + await stream.cast>().pipe(res); return false; } else { var transformer = RangeHeaderTransformer( @@ -324,7 +325,11 @@ class VirtualDirectory { transformer.computeContentLength(totalFileSize).toString(); res.contentType = MediaType( 'multipart', 'byteranges', {'boundary': transformer.boundary}); - await file.openRead().transform(transformer).pipe(res); + await file + .openRead() + .cast>() + .transform(transformer) + .pipe(res); return false; } } diff --git a/pubspec.yaml b/pubspec.yaml index f18bdd8d..33d4a02e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ environment: sdk: ">=2.0.0 <3.0.0" homepage: https://github.com/angel-dart/static author: Tobe O -version: 2.1.3+1 +version: 2.1.3+2 dependencies: angel_framework: ^2.0.0-rc.0 convert: ^2.0.0