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

MFS ipfs.files.cp arguments #262

Closed
achingbrain opened this issue May 3, 2018 · 4 comments
Closed

MFS ipfs.files.cp arguments #262

achingbrain opened this issue May 3, 2018 · 4 comments

Comments

@achingbrain
Copy link
Collaborator

What's the thinking behind the ipfs.files.cp arguments? Specifically why is the first argument an array?

ipfs.files.cp([sourceFile, destinationFile], callback)

It could be more straightforward as:

ipfs.files.cp(sourceFile, destinationFile, callback)

I suppose maybe you'd want to imitate the unix cp command and support both the above and:

ipfs.files.cp(...sourceFiles, destinationDirectory, callback)

Obviously JavaScript doesn't support left-variadic functions so you'd have to emulate it by interrogating arguments but that's an implementation detail.

@achingbrain achingbrain changed the title MFS files.cp arguments MFS ipfs.files.cp arguments May 3, 2018
@alanshaw
Copy link
Contributor

I'm +1 on removing the single array argument in favour of two arguments unless there's a good reason for it. @diasdavid what do you think?

It's also super confusing in the docs right now because we use square brackets to denote an optional arg.

N.B. files.mv has the same API

@daviddias
Copy link
Contributor

👍 on removing the array proposal too.

@achingbrain
Copy link
Collaborator Author

Great, I'll put a PR together tomorrow.

@achingbrain
Copy link
Collaborator Author

See #277 for more on this.

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

No branches or pull requests

3 participants