Skip to content

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

@lasiar

Description

@lasiar

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)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    need/triageNeeds initial labeling and prioritization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions