js-kubo-rpc-client icon indicating copy to clipboard operation
js-kubo-rpc-client copied to clipboard

ipfs.files.mv(from, to, { parents: true }), failing when parent directories don’t exist

Open matthewjosephtaylor opened this issue 1 month ago • 0 comments

Using v6.0.2 of kubo-rpc-client and 0.38.1 of the kubo docker container.

NOTE: the 'mv' command which works if I pre-create the directories ahead of time.

Error

file does not exist
HTTPError: Internal Server Error

the POST URL the library is calling

http://<host>:5001/api/v0/files/mv?parents=true&arg=%2Ftest%2Fhello.txt&arg=%2Ftrash%2Ftest%2Fhello.txt 500 (Internal Server Error)

Possible fix

Perhaps need to update docs to reflect that 'parents:true' is not respected by Kubo node backend?

Workaround

    const trashDir = dirname(trashPath);
    await ipfs.files.mkdir(trashDir, { parents: true });
    return ipfs.files.mv(path, trashPath); 

matthewjosephtaylor avatar Oct 26 '25 22:10 matthewjosephtaylor