You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/09/12 11:26:22 UTC

[GitHub] [cordova-plugin-file] Kepro commented on issue #412: File access in Browser?

Kepro commented on issue #412:
URL: https://github.com/apache/cordova-plugin-file/issues/412#issuecomment-691473385


   This is the code that I'm using... have the same issue
   ```
   static async getPersistentFS(): Promise<FileSystem> {
   		if (cordova.platformId === 'browser' || cordova.platformId === 'electron') {
   			return new Promise((resolve, reject) => {
   				window.requestFileSystem(window.PERSISTENT, 0, (fileSystem) => {
   					FilesystemTool.fileSystem = fileSystem;
   					Logger.info('Filesystem opened!', fileSystem);
   					resolve(fileSystem);
   				}, (err) => {
   					reject(err);
   					console.error('Failed open file system', err.toString());
   				});
   			});
   		}
   
   		return new Promise((resolve, reject) => {
   			window.resolveLocalFileSystemURL(cordova.file.dataDirectory, (dirEntry) => {
   				FilesystemTool.fileSystem = dirEntry.filesystem;
   				resolve(dirEntry.filesystem);
   			}, (err) => {
   				reject(err);
   				console.error('Failed open file system', err.toString());
   			});
   		});
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org