Get Object Data via go-ipfs-http-client library

I am able to get traits of project using cURL as below

curl -X POST -u “projectId:projectSecreat” “

How to get same data via golang library

package main

import (






    ipfsApi "" // v0.1.0

    path ""


func main() {

    projectId := "1ylb...."

    projectSecret := "1f9...."

    httpClient := &http.Client{}

    httpApi, err := ipfsApi.NewURLApiWithClient("", httpClient)

    if err != nil {




    httpApi.Headers.Add("Authorization", "Basic "+basicAuth(projectId, projectSecret))

    //content := strings.NewReader("Infura IPFS - Getting started demo.")

    mypath := path.New("Qmb5zeyvU7ZpotLDzkUmSeMDA71MExp8eJyNeefGdoeA2x")

    files, err := httpApi.Object().Get(context.Background(), mypath)

    if err != nil {




    for i := 0; i < len(files.Links()); i++ {





func basicAuth(projectId, projectSecret string) string {

    auth := projectId + ":" + projectSecret

    return base64.StdEncoding.EncodeToString([]byte(auth))


This give me right number of links, how to get data which we receive via cURL from links object ?

Hi @cycorax12,

When you say it gives you the right number of links, are you referring to the hashes? In order to access the data from these files, you’d need to get the hash for each of the items you uploaded.