Open iostat opened 6 years ago
Size is the size of all data behind this hash. Your message packed in dag node and size of dag node with your message is 20b.
You can check it by:
ipfs block get Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP
You can use
/api/v0/add?raw-leaves=true
With raw-leaves data less than 256kb Size will be same as data size.
Thanks for the reply! I figured after opening this issue that that's what's happening here. Seems very counterintuitive for anyone who doesn't know much of IPFS internals, though. Is this perhaps something that is/should be clarified in docs somewhere?
Version information:
Type:
Bug
Description:
The HTTP API reports an incorrect size for a file added to IPFS via the
/api/v0/add
endpoint.To reproduce: 0) Clean slate:
rm -rf ~/.ipfs && ipfs init && ipfs daemon &
1) Create a file namedtestfile
containing just the contents:Plz add me!<LF>
. This is exactly 12 bytes. 2)POST
to/api/v0/add
to add the file. 3) Observe that the response says theSize
is 20. 4) Read it back viaipfs cat Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP | wc -c
and observe it was correctly stored with its 12 byte length.Sample session follows:
Note that building a 0.4.16 master correctly shows
12 B
in theipfs add
command, but still reports"Size": "20"
over the HTTP API.