Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a backward-compatible extension that pulls in no extra dependencies. It makes use of mkdirs() safer, by allowing the developer to specify how many levels of hierarchy are allowed to be created by mkdirs(). Because mkdirs() will happily create whatever you tell it to, sometimes you don't find the error in your logic right away and you end up creating directories in unintended places.
Another benefit of this extension is that it gives you the semantics of "ensureDirectory()" from some other fs extensions. The idea behind this is that you want to create a directory if it doesn't already exist, but you don't want an error if it does already exist. In this case, you don't want a hierarchy of directories created, just a single directory, and it would be a legitimate error if the parent directory did not exist. You can do this with the base fs functions, but it gets a little ugly and requires seven lines of code where you only need one.