To use the exists function from the fs-extra library in typescript, you can follow these steps:
index.ts28 chars2 lines
index.ts35 chars2 lines
exists
function to check if a file or directory exists:index.ts332 chars12 lines
The exists
function returns a Promise that resolves to true
if the path exists, and false
if the path does not exist.
Note: The exists
function from fs-extra is a promise-based function, so you need to use .then()
and .catch()
to handle the result and any errors respectively.
gistlibby LogSnag