How to use the cordova-plugin-file.fileSystems.getFs function in cordova-plugin-file

To help you get started, we’ve selected a few cordova-plugin-file examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apache / cordova-plugin-file / www / blackberry10 / createEntryFromNative.js View on Github external
/* eslint-disable no-undef */
        entry.nativeURL = 'file:///' + FileSystem.encodeURIPath(native.fullPath);
    } else if (entry.nativeURL.indexOf('filesystem:local:///persistent/') === 0) {
        entry.nativeURL = info.persistentPath + FileSystem.encodeURIPath(native.fullPath);
    } else if (entry.nativeURL.indexOf('filesystem:local:///temporary') === 0) {
        entry.nativeURL = info.temporaryPath + FileSystem.encodeURIPath(native.fullPath);
    }
    /* eslint-enable no-undef */
    // translate file system name from bb10 webkit
    if (entry.filesystemName === 'local__0:Persistent' || entry.fullPath.indexOf(persistentPath) !== -1) {
        entry.filesystemName = 'persistent';
    } else if (entry.filesystemName === 'local__0:Temporary' || entry.fullPath.indexOf(temporaryPath) !== -1) {
        entry.filesystemName = 'temporary';
    }
    // add file system property (will be called sync)
    fileSystems.getFs(entry.filesystemName, function (fs) {
        entry.filesystem = fs;
    });
    // set root on fullPath for persistent / temporary locations
    entry.fullPath = entry.fullPath.replace(persistentPath, '');
    entry.fullPath = entry.fullPath.replace(temporaryPath, '');
    // set trailing slash on directory
    if (entry.isDirectory && entry.fullPath.substring(entry.fullPath.length - 1) !== '/') {
        entry.fullPath += '/';
    }
    if (entry.isDirectory && entry.nativeURL.substring(entry.nativeURL.length - 1) !== '/') {
        entry.nativeURL += '/';
    }
    return entry;
};