ipfs-inactive/js-ipfs-http-client

Unable to add content with the 42.0.0

xmaysonnave opened this issue · 1 comments

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

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