1 possible answer(s) on “doc: DEP0034 no viable replacement for fs.exists

  1. fs.exists() is discouraged because it doesn’t follow Node’s normal callback conventions, and often introduces race conditions into your code. fs.stat() and fs.access() don’t throw on missing paths, they call their callback with an error object. fs.exists() calls fs.access() under the hood and then converts the error to a boolean.

    EDIT: It’s also worth noting that fs.existsSync() is not deprecated if your use allows for it.