readBytes method

  1. @override
Future<Uint8List> readBytes(
  1. String path, {
  2. int? maxBytes,
})
override

Reads path fully; throws PayloadTooLargeException above maxBytes.

Implementation

@override
Future<Uint8List> readBytes(String path, {int? maxBytes}) async {
  final f = _file(path);
  if (maxBytes != null && await f.length() > maxBytes) {
    throw PayloadTooLargeException('entry "$path" exceeds $maxBytes bytes');
  }
  return f.readAsBytes();
}