Skip to content
Advertisement

How to get file contents from ipfs-http-client

I am using ipfs-http-client to read the contents of a file form infura, how do i use the “cat” funtionality to correctly get the data in a string/json format?

JavaScript

right now i am just getting a array of binaries on the console log.

Advertisement

Answer

From this point on its just a matter of decoding the content buffer.

If the content is some JSON:

JavaScript

If the content is an image:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement