Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ensure methods #31

Closed
jprichardson opened this issue Oct 8, 2013 · 5 comments
Closed

Add ensure methods #31

jprichardson opened this issue Oct 8, 2013 · 5 comments

Comments

@jprichardson
Copy link
Owner

"ensure" methods would ensure some type of behavior. For example ensureDir(dir) would ensure that the dir exists. Or even better, ensurePath(path) would ensure that the file or directory exists. ensureDelete(path), ensureGone(path) or something similarly named would ensure that the path is deleted or does not exist.

Maybe these names:

  • ensurePathExists(path)
  • ensurePathNotExists(path)

but those feel a bit verbose.

Any ideas?

@jprichardson
Copy link
Owner Author

Possible related to #22

@jprichardson
Copy link
Owner Author

Maybe ensurePath(path, [exists])?

So, ensurePath(path, true) would ensure that it exists and ensurePath(path, false) would ensure that it does not exist? Although, I don't feel that the boolean arguments make it clear enough.

@jprichardson
Copy link
Owner Author

Other candidates:

  • ensureFile(filePath)
  • ensureDir(dirPath)
  • ensureDeleted(path) <-- either file or dir

@jprichardson
Copy link
Owner Author

ensureFile() will probably just be an alias for createFile().

jprichardson added a commit that referenced this issue May 22, 2014
@jprichardson
Copy link
Owner Author

ovr pushed a commit to ovr/node-fs-extra that referenced this issue Nov 12, 2020
Bumps [strip-ansi](https://github.com/chalk/strip-ansi) from 5.0.0 to 6.0.0.
- [Release notes](https://github.com/chalk/strip-ansi/releases)
- [Commits](chalk/strip-ansi@v5.0.0...v6.0.0)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant