Running your own checks before running Sharp adds extra dependencies and complexity to an app. It's an easily fixed gotcha; Sharp could automatically create directories that don't yet exist for a .toFile path.
Please use a module such as mkdirp, which is already a transient dependency of sharp via tar. See also #639.
@lovell it was not a question, it was a suggestion. I know how to work around the behavior, my suggestion is to build the smarts into Sharp so people don't need to think about it.
Is there a particular reason why it is a bad idea?
I feel having the right filesystem directory present with the right permissions at the right time is beyond the responsibility of an image processing library. I'm very happy for the docs to provide links to well-maintained wrappers/utilities that build on sharp and provide such extra behaviour.
Most helpful comment
I feel having the right filesystem directory present with the right permissions at the right time is beyond the responsibility of an image processing library. I'm very happy for the docs to provide links to well-maintained wrappers/utilities that build on sharp and provide such extra behaviour.