Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

parents: true not work for ipfs.files.cp #3747

Closed
bluelovers opened this issue Jul 17, 2021 · 5 comments
Closed

parents: true not work for ipfs.files.cp #3747

bluelovers opened this issue Jul 17, 2021 · 5 comments
Labels
need/triage Needs initial labeling and prioritization

Comments

@bluelovers
Copy link
Contributor

  • Version:
  • Platform:
  • Subsystem:

Severity:

Description:

parents: true not work for ipfs.files.cp

Steps to reproduce the error:

@bluelovers bluelovers added the need/triage Needs initial labeling and prioritization label Jul 17, 2021
@achingbrain
Copy link
Member

Can you please provide some steps to reproduce the error?

@bluelovers
Copy link
Contributor Author

						await ipfs.files.rm(file_path).catch(e => null);

						await ipfs.files.cp(`/ipfs/${file_cid}`, file_path, {
							parents: true,
						});

@achingbrain
Copy link
Member

file_path is not defined?

Can you share a stack trace?

@bluelovers
Copy link
Contributor Author

image

import { searchIpfs } from '../lib/ipfs/use';
import { ipfsAddresses } from 'ipfs-util-lib';
import console from 'debug-color2/logger';

searchIpfs()
.then(async ({ ipfs, stop }) => {

	const dir_path = `/1/2/3`;
	const file_path = `${dir_path}/file.txt`;
	const file_cid = `QmWGpaUBePXU3jyCXtY4hmtmawYSep8QnnBoziiqdzbGVH`;

	await ipfs.version().then(console.info);

	let dir_stat = await ipfs.files.stat(dir_path).catch(e => null);
	let file_stat = await ipfs.files.stat(file_path).catch(e => null);

	console.dir({
		dir_stat,
		file_stat,
	});

//	await ipfs.files.mkdir(dir_path, {
//		parents: true,
//	}).catch(e => null);
	await ipfs.files.rm(file_path).catch(e => null);

	await ipfs.files.cp(`/ipfs/${file_cid}`, file_path, {
		parents: true,
	});

	return stop()
})

@achingbrain
Copy link
Member

The error is coming from go-ipfs and I don’t think it’s cp command supports the parents option, you’ll need to mkdir first.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

2 participants