filer.js icon indicating copy to clipboard operation
filer.js copied to clipboard

Getting an error while creating simple persistent file

Open sohamm17 opened this issue 8 years ago • 2 comments

I'm writing a Chrome extension and added below code in content script. I'm getting the following error:

Error in event handler for runtime.onMessage: Error: Filesystem has not been initialized. at Object.Filer.create (chrome-extension://fgagghgfkjlcgiamgopcfoomblpnglko/filer.js:616:13)

var filer = new Filer();

filer.init({persistent: true, size: 1024 * 1024}, function(fs) {
  // filer.size == Filer.DEFAULT_FS_SIZE
  // filer.isOpen == true
  // filer.fs == fs
}, onError);

filer.create('/home/myFile.txt', false, function(fileEntry) {
  // fileEntry.name == 'myFile.txt'
}, onError);

sohamm17 avatar Oct 02 '16 00:10 sohamm17

This might have something to do with the extension permission model. The content script lives in its own world (origin). Can you create the FS within the extension context and message pass between it and the content script?

ebidel avatar Oct 02 '16 21:10 ebidel

I'm getting this error, too.

edit: Nevermind. Saw this error in the extensions manager:

'fileSystem' is only allowed for packaged apps, but this is a extension.

fireundubh avatar Jul 19 '17 17:07 fireundubh