read static method

Stream<Uint8List> read(
  1. String key, {
  2. UStorageBucket bucket = UStorageBucket.support,
  3. int start = 0,
  4. int? end,
})

Streams [start, end) of an entry. Vault entries decrypt only the chunks in range, which is what lets encrypted video seek.

Implementation

static Stream<Uint8List> read(String key, {UStorageBucket bucket = UStorageBucket.support, int start = 0, int? end}) async* {
  await _ensure();
  final UStorageEntry? entry = _live(key, bucket);
  if (entry == null) throw StateError("No entry '$key' in ${bucket.name}.");
  _touch(entry);
  final String path = _pathFor(bucket, key);
  yield* bucket == UStorageBucket.vault ? (await vaultKeys).read(path, start: start, end: end) : _backend.read(path, start: start, end: end);
}