boxo icon indicating copy to clipboard operation
boxo copied to clipboard

[ipfs/go-ipfs-files] Possibility WriteTo to exist dir

Open lasiar opened this issue 4 years ago • 3 comments

Maybe add to function WriteTo the feature for write to exist directory?

two choices:

  1. Change exist function:
// WriteTo writes the given node to the local filesystem at fpath.
func WriteTo(nd Node, fpath string, toExist bool) error {
	switch nd := nd.(type) {
	...
	case Directory:
		err := os.Mkdir(fpath, os.ModePerm)

		switch {
		case errors.Is(err, os.ErrExist):

		case err != nil:
			return err
		}
        ...
  1. Add a function with an additional argument ignoreExist or something else. Use exist fucntion WriteTo like a wrapper:
// WriteTo writes the given node to the local filesystem at fpath.
func WriteTo(nd Node, fpath string) error {
	return WriteToWithParams(nd, fpath, false)
}

lasiar avatar Jul 20 '21 18:07 lasiar

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:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

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

welcome[bot] avatar Jul 20 '21 18:07 welcome[bot]

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:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

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

welcome[bot] avatar Jan 13 '23 13:01 welcome[bot]

This is a similar issue I have posted here: https://github.com/ipfs/boxo/issues/520

As a bonus some kind of return int64 progress would be great too please. Thanks! :)

P.S. For example func fileArchive(f files.Node, name string, archive bool, compression int) (io.ReadCloser, error) {} function has io.ReadCloser in kubo/core/commands/get.go. Also there are archive bool, compression int arguments which are not present in boxo/files/filewriter.go func WriteTo(nd Node, fpath string) error {} function which only returns error.

ofman avatar Dec 13 '23 18:12 ofman