commit | d012b2cf3a76162fdadb8a1eb74507239ea45f26 | [log] [tgz] |
---|---|---|
author | Jason Daly <lyceel@gmail.com> | Tue Jun 06 20:17:51 2017 |
committer | Lasse R.H. Nielsen <lrn@google.com> | Tue Jun 06 20:17:51 2017 |
tree | ecc0f7413e2889d3a795ea982eb73a989cf1811c | |
parent | 3b1ee7b6abf6ce80877421067360ce7ed64eccb0 [diff] |
Fix bug in `readAsBytes` via http when content-length is set. (#24) The `readAsBytes` method returns twice as much data as expected, with the first half all zeroes. This comes from pre-allocating the buffer, then appending to it (similar to issue 21, but with `readAsBytes` instead of `readAsString`). Updated the tests to also catch this case. BUG: https://github.com/dart-lang/resource/issues/23
Reading data from package contents and files.
A resource is data that can be read into a Dart program at runtime. A resource is identified by a URI. It can be loaded as bytes or data. The resource URI may be a package: URI.
Example:
import 'package:resource/resource.dart' show Resource; import 'dart:convert' show UTF8; main() async { var resource = new Resource("package:foo/foo_data.txt"); var string = await resource.readAsString(encoding: UTF8); print(string); }
Please check out the API docs.
Please file feature requests and bugs at the issue tracker.