To use the exists
function from fs-extra
, you can follow the steps below:
index.tsx21 chars2 lines
index.tsx32 chars2 lines
exists
function to check whether a file or directory exists:index.tsx271 chars10 lines
The exists
function returns a promise that resolves to a boolean value indicating whether the specified file or directory exists or not. If the specified file or directory exists, the promise resolves to true
, otherwise it resolves to false
.
Note that you can also use the exists
function synchronously if you don’t need a promise:
index.tsx223 chars8 lines
gistlibby LogSnag