OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library barback.utils.file_pool; | 5 library barback.utils.file_pool; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 var completer = new Completer<List<int>>(); | 57 var completer = new Completer<List<int>>(); |
58 var builder = new BytesBuilder(); | 58 var builder = new BytesBuilder(); |
59 | 59 |
60 openRead(path).listen(builder.add, onDone: () { | 60 openRead(path).listen(builder.add, onDone: () { |
61 completer.complete(builder.takeBytes()); | 61 completer.complete(builder.takeBytes()); |
62 }, onError: completer.completeError, cancelOnError: true); | 62 }, onError: completer.completeError, cancelOnError: true); |
63 | 63 |
64 return completer.future; | 64 return completer.future; |
65 } | 65 } |
66 } | 66 } |
OLD | NEW |