I know exists is deprecated in fs but it is able in fs-extra.
I used both fsExtra.pathExists and fsExtra.exists.
But I could not find the difference.
They performe same.
There is not much difference between these two methods.
fs-extra
is a superset of fs
, inheriting all its methods, so fsExtra.exists
is the same as fs.exists
. And as you said it's deprecated.
The difference between exists()
and pathExists()
lies in the signature of the functions.
Like fs.exists, but with a normal callback signature (err, exists).
Internally, fs
native module use a try catch block, while fs-extra
use a Promise style. And they both use fs.access()
method to determine if the specified file is accessible.
And yes, they both have the same use.