add method
Adds data and returns its CID.
The bytes are chunked into a UnixFS DAG with the same layout
IPFSNode.addFile produces on native platforms (Kubo ipfs add
defaults: 256 KiB chunks, raw leaves off): a payload that fits in
one chunk is stored as a single UnixFS file node whose CID is the
root, larger payloads produce a DAG-PB root linking each chunk in
order, and empty input yields the well-known empty-file block.
Identical bytes therefore produce identical CIDs on web and native
nodes.
NOTE: CIDs differ from earlier releases of this method, which stored a single raw CIDv1 block.
Implementation
Future<CID> add(
Uint8List data, {
int cidVersion = 0,
bool rawLeaves = false,
}) => addStream(
Stream<List<int>>.value(data),
cidVersion: cidVersion,
rawLeaves: rawLeaves,
);