ipfs-haskell icon indicating copy to clipboard operation
ipfs-haskell copied to clipboard

Unable to send to Remote

Open bhoudebert opened this issue 2 years ago • 1 comments

Hi,

First of all, not really a bug but more of a lacking of how to achieve it.

We are trying to add something to IPFS with the library, using the remote part.

add is expecting a ByteString but there is no documentation of how to format that ByteString. Therefore it does not work and ask for the famous path argument (which is not even this name but error come from ipfs node anyway).

So how do we call the function add to provide the file name and also the encoding maybe?

res <- runRemote (add "blabla")

Anyway, I read the IPDS doc, still not clear to me.

curl --location --request POST 'http://localhost:5001/api/v0/add' \
--form 'myfile.txt="kkk"'
# returns
{
    "Name": "QmSj2KoTnMesarHGBRiWkh8TxqrwjgpayAmxLWFK56TEfc",
    "Hash": "QmSj2KoTnMesarHGBRiWkh8TxqrwjgpayAmxLWFK56TEfc",
    "Size": "11"
}

This is not totally working, uploaded to ipfs node but the name is trash and therefore cannot handle any directly I assume, still the content is "okay" with "kkk" as value.

I assume I am missing something for the Haskell part, thanks for any tips there (may offer you later a documentation PR + some free examples if you wish)

bhoudebert avatar Mar 06 '22 23:03 bhoudebert