Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70432

Ionic Capacitor Filesystem fileExist

$
0
0

@ElDiabolus wrote:

I have some pictures stored on /src/assets/img/.
Now I want to check if an image exists. If yes I want to display it, else I want to display a placeholder img.

I tried

async checkFile(strPath: string)
    {
        let contents = await Filesystem.readFile({
            path: strPath,
            directory: FilesystemDirectory.Data,
            encoding: FilesystemEncoding.UTF8
        });
        console.log(contents);
    }
checkFile('/assets/img/kategorien/image.jpg).then(function ...

But it doesn’t work. The file is not found. How do I have to set the path/directory for it to work?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70432

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>