hasBlock method

  1. @override
Future<bool> hasBlock(
  1. String cid
)

Returns a Future that resolves to true if a block with the given cid exists.

Implementation

@override
/// Returns a [Future] that resolves to `true` if a block with the given [cid] exists.
Future<bool> hasBlock(String cid) async {
  try {
    if (_blockIndex.contains(cid)) return true;
    return await getPlatform().exists(p.join(path, cid));
  } catch (e) {
    _logger.error('Failed to check block existence', e);
    return false;
  }
}