toBytes method

Uint8List toBytes()

Converts the MerkleDAGNode to its byte representation. Note: This assumes data is already strictly formatted (e.g. valid UnixFS Data proto bytes). If you are building a node, ensure data is correct.

Implementation

Uint8List toBytes() {
  final pbNode = dag_proto.PBNode()..data = data;

  pbNode.links.addAll(links.map((link) => link.toProto()));

  return marshalDagPBNode(pbNode);
}