Standard Format
Here is the Merkle DAG of a file containing the "hello world" string.
{
"Links": [],
"Data": "\u0008\u0002\u0012\u000bhello world\u0018\u000b"
}
Data
is the protobuf encoding of the UnixFS Data.
{
"Type": 2,
"Data": "aGVsbG8gd29ybGQ=",
"FileSize": 11,
"BlockSizes": null,
"HashType": null,
"Fanout": null
}
Chunked Format
When the file's data exceeds the chunking size, multiple blocks
are generated. The returned CID points to a block that has Merkle.Links
. Each link
contains a chunk of the file.
The following uses a chunking size of 6. A primary and two secondary blocks are created for "hello world".
Primary Block
{
"Links": [
{"Name": "", "Hash": "QmPhmNbdBMtSQczNc4hnsMxRf5L4vfkU8jRTXDSHj8trSV", "Size": 14},
{"Name": "", "Hash": "QmNyJpQkU1cEkBwMDhDNFstr42q55mqG5GE5Mgwug4xyGk", "Size": 13}
],
"Data":"\u0008\u0002\u0018\u000b \u0006 \u0005"
}
{
"Type": 2,
"Data": null,
"FileSize": 11,
"BlockSizes": [6,5],
"HashType":null,
"Fanout":null
}
First Link
{
"Links": [],
"Data": "\u0008\u0002\u0012\u0006hello \u0018\u0006"
}
Second Link
{
"Links": [],
"Data": "\u0008\u0002\u0012\u0005world\u0018\u0005"
}