ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.44k stars 1.25k forks source link

JS-ipfs-http-client / Go-IPFS does not support files.cp multiple files a time? [HTTPError: cp: cannot put node in path /ipfs/...: file does not exist] #4223

Closed tx0c closed 2 years ago

tx0c commented 2 years ago

Severity:

Description:

  1. ipfs.files.cp(['/ipfs/<CID1>', '/ipfs/<CID2>', '/ipfs/<CID3...>'], '/dest-dir')
  2. it errors [HTTPError: cp: cannot put node in path /ipfs/...: file does not exist]
  3. files.cp multiple files (including ipfspath) to a single directory is documented https://github.com/ipfs/js-ipfs/blob/master/docs/core-api/FILES.md#ipfsfilescpfrom-to-options but seems not supported by Go-IPFS server

with some debugging logs printing, I got this:

[Symbol(Response internals)]: {
  url: 'http://<go-ipfs-host>:5001/api/v0/files/cp?arg=%2Fipfs%2F<CID1...>&arg=%2Fipfs%2F<CID2...>&
 arg=%2Fipfs%2F<CID3...>&arg=...&arg=%2F/dest-dir',
  status: 500,
  statusText: 'Internal Server Error',
  headers: [Headers],
  counter: 0
}

it seems just translate all from paths as arg, and /dest-dir as the last arg, but from https://docs.ipfs.tech/reference/kubo/rpc/#api-v0-files-cp it seems support only a single file/dir/ipfspath at a time

Steps to reproduce the error:

Similar to #3547 there are many implementation details different between Js-IPFS vs Go-IPFS, but Js-IPFS has a poor performance if running as daemon server, in most cases call JS-ipfs-http-client interact'ing with Go-IPFS daemon server

welcome[bot] commented 2 years ago

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

Finally, remember to use https://discuss.ipfs.io if you just need general support.

achingbrain commented 2 years ago

This is something js-ipfs supports that go-ipfs does not. If you'd like to add support, please open a PR against the kubo repo. You can also switch to kubo-rpc-client which will be kubo-only going forward so will not support the extra niceties that js-ipfs does.