readBytes method
The bytes of the single-file artifact at locator.
Implementation
@override
Future<Uint8List> readBytes(String locator) async {
final loc = TomGitLocator.parse(locator);
final t = await _tip(locator, loc);
final tip = t.tip;
if (tip == null) throw TomContainerNotFoundException(locator);
final repo = t.endpoint.repo;
final entry = await repo.entryAt(
(await repo.readCommit(tip)).tree,
t.loc.path,
);
if (entry == null) throw TomContainerNotFoundException(locator);
if (entry.isTree) {
throw TomStorageException(locator, 'Not a single-file container');
}
final bytes = await repo.readBlob(entry.id);
tomRefuseLfsPointer(locator, t.loc.path, bytes, remedy: lfsRemedy);
return bytes;
}