Home > Software design >  Curl request to IPFS Get API adds bytes to header of downloaded file
Curl request to IPFS Get API adds bytes to header of downloaded file

Time:07-09

I have an IPFS node on an linux box. If i use:

ipfs get QmYqGwoiuw47cLhrtQ5yg1TnS6n2ekcLSZZt35gGestTuo

at command line the ipfs image (a png) is downloaded and usable.

However when i hit the equivalent endpoint using CURL:

curl --location --request POST 'http://127.0.0.1:5001/api/v0/get?arg=QmYqGwoiuw47cLhrtQ5yg1TnS6n2ekcLSZZt35gGestTuo' --output QmYqGwoiuw47cLhrtQ5yg1TnS6n2ekcLSZZt35gGestTuo

The file downloaded is identical except it has some bytes at the start of the file.

enter image description here

These appear before the �PNG identifier at the top of the file. (Appears to be the CID followed by some nullstrings then some numbers)

Is there anything i'm doing wrong in my post request to download the file correctly? As currently the files downloaded using CURL are unusable.

CodePudding user response:

PNG header

  • Related