Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Unable to add content with the 42.0.0 #1243

Closed
xmaysonnave opened this issue Mar 4, 2020 · 1 comment
Closed

Unable to add content with the 42.0.0 #1243

xmaysonnave opened this issue Mar 4, 2020 · 1 comment

Comments

@xmaysonnave
Copy link

I tried to qualify the latest with our DApp and was unable to add anything.
I downgraded to the 41.0.1.

Here is the code snippet I use :

    // 1 - https://github.com/ipfs/go-ipfs/issues/5683
    // default chunker: "size-262144"
    // chunker: "rabin-262144-524288-1048576"
    // 2 - TODO: small content generates a wrong cid when cidVersion: 1 is set:
    // Not a 'dag-pb' but a 'raw' multicodec instead
    // We generate a V0 and convert it to a V1
    // https://github.com/xmaysonnave/tiddlywiki-ipfs/issues/14
    const result = await client.add(buffer, {
      cidVersion: 0,
      hashAlg: "sha2-256",
      chunker: "rabin-262144-524288-1048576",
      pin: false
    });
    // Check
    if (result == undefined || result == null || Array.isArray(result) === false || result.length === 0) {
      throw new Error("IPFS client returned an unknown result...");
    }
    // Convert
    const cidv1 = this.cidV0ToCidV1(result[0].hash);
    return {
      hash: cidv1,
      size: result[0].size
    }; 

The first screenshot shows the usual array I receive when added while the second screenshot
shows an unfamiliar object, definitely not an array.

ipfs-http-client-add-41 0 1

ipfs-http-client-add-42 0 0

Any advise will be greatly appreciated.

Warmly

@xmaysonnave
Copy link
Author

According to the migration guide I receive an Iterable.
I close this issue as it's irrelevant.
Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant