Ionic 2 File Plugin usage examples.


Does anyone have complete examples about how to use the Cordova File Plugin in a Ionic 2/Angular 2 project?

I installed this plugin but the documentation don’t seems to make much sense to me due the fact it is fragmented and lacks of a complete example, including all needed imports.

For example, this example don’t show where come from objects like LocalFileSystem or window.

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fs) {

    console.log('file system open: ' +;
    fs.root.getFile("newPersistentFile.txt", { create: true, exclusive: false }, function (fileEntry) {

        console.log("fileEntry is file?" + fileEntry.isFile.toString());
        // == 'someFile.txt'
        // fileEntry.fullPath == '/someFile.txt'
        writeFile(fileEntry, null);

    }, onErrorCreateFile);

}, onErrorLoadFs);


Duplicate of Ionic 2 File Plugin usage examples


you declared this duplicated and the other want you closed it, but didn’t provide any answer, I hope we don’t go "stackoverflow " in this community…regards