BrowserFS icon indicating copy to clipboard operation
BrowserFS copied to clipboard

indexedDB inside MountableFileSystem require options

Open jcubic opened this issue 6 years ago • 10 comments

I had code like this:

BrowserFS.configure({
    fs: 'MountableFileSystem',
    options: {
        '/': { fs: 'IndexedDB'},
        '/tmp': { fs: 'InMemory' }
    }   
    //fs: 'IndexedDB', options: {}
}, function(err) {

});

and it throw exception somewhere from browserfs, if I add opitons for indexedDB the error go away.

It should be documented that options is required.

jcubic avatar Jun 03 '18 07:06 jcubic

Thanks for the note!

jvilk avatar Jun 29 '18 17:06 jvilk

I suggest to fix the example in the README.md file ASAP, it's not cool if the very first example new users might run already throws an exception.

Also this is probably a bug and not a documentation issue. Looking at the notes for release 1.4.3:

Options object is optional for Create() methods when file system takes no options. Previously, the behavior was inconsistent. Now, calling Create(cb) is equivalent to calling Create({}, cb).

The exact error message for me is

Uncaught TypeError: Cannot read property 'storeName' of undefined

which to me sounds as if undefined gets passed instead of {}.

Syndace avatar Jul 06 '18 14:07 Syndace

This bug is still reproducible at the time I'm writing this.

Mastaleru avatar Sep 28 '18 11:09 Mastaleru

fwiw, still running into this

pyramation avatar Dec 07 '18 13:12 pyramation

This is still an issue

codenamezjames avatar Jun 22 '19 18:06 codenamezjames

Bumping @jvilk

emeryberger avatar Jun 23 '19 16:06 emeryberger

Bumping @jvilk

Project-Magenta avatar Aug 22 '19 21:08 Project-Magenta

use this

options: {
      "/zip": {
        fs: "ZipFS",
        options: {
          // Wrap as Buffer object.
          zipData: Buffer.from(zipData)
        }
      },
      "/tmp": { fs: "InMemory" },
      "/home": { fs: "IndexedDB",
        options: {
           storeName : "mydata"
        }
      }
    }

add

options: {
           storeName : "mydata"
}

killinux avatar Jul 06 '20 06:07 killinux

@killinux Your comment make no sense, in the original post I've added that options are required and it's not documented.

jcubic avatar Jul 06 '20 15:07 jcubic

Still an issue, even if not inside MountableFileSystem. This works:

{ fs: "IndexedDB", options: { storeName: "your_name_here", }, },

soren-mou-jakobsen avatar Dec 12 '21 17:12 soren-mou-jakobsen

Fixed in #352

james-pre avatar Apr 28 '23 20:04 james-pre