toPrefixBytes method

Uint8List toPrefixBytes()

Returns the CID prefix bytes (version + codec + multihash function + hash length), omitting the digest itself.

Implementation

Uint8List toPrefixBytes() {
  final bytes = toBytes();
  final digestLength = multihash.size;
  if (bytes.length <= digestLength) {
    return bytes;
  }
  return Uint8List.fromList(bytes.sublist(0, bytes.length - digestLength));
}