I know from here that the official position is to not check for existence before manipulating a file: Node.js check exist file Rather, one should simply attempt the write and handle whatever exceptions may be thrown.
However, my scenario is that I want to only write a certain file to a folder given that the file does not already exist. If the file exists, I want to do nothing.
What would be the idiomatic way to accomplish this?