Capacitor: Need dedicated method for checking if a file exists

Created on 5 Nov 2018  路  2Comments  路  Source: ionic-team/capacitor

I have been using stat for this, but it's not semantically ideal and it is a common enough action that I think it should be part of the core API.

enhancement feature request filesystem low

Most helpful comment

Would love this - currently getUri throws exception of web if file doesnt exist but on device returns a formulated string so is messy to work with.
Using stat can emulate this but a fileExists fn would be much better - any chance ionic can reconsider and resolving merge conflicts from the provided PR to include this change?

All 2 comments

Issues tagged with feature request are closed but tracked for reactions to gauge interest.

Since our file API is similar to the node one, I think we should use access instead of fileExists.
Also, it should cover web and electron too.

Would love this - currently getUri throws exception of web if file doesnt exist but on device returns a formulated string so is messy to work with.
Using stat can emulate this but a fileExists fn would be much better - any chance ionic can reconsider and resolving merge conflicts from the provided PR to include this change?

Was this page helpful?
0 / 5 - 0 ratings