jvilk / BrowserFS

BrowserFS is an in-browser filesystem that emulates the Node JS filesystem API and supports storing and retrieving files from various backends.
Other
3.06k stars 215 forks source link

[WIP] Recover from missing root after IndexedDB cleared #226

Closed 1j01 closed 6 years ago

1j01 commented 6 years ago

Only at init time; maybe it should be able to recover immediately!

I mean, "Fix missing root in IndexedDB after database cleared" is, well, maybe not inaccurate, but it doesn't happen immediately; it doesn't recover immediately. It takes a page refresh of an app, generally.

Also I took a stab at testing this, and this passes, but haven't tested whether the test tests it yet:

  // Does the root directory exist in empty file systems? It should!
  BrowserFS.FileSystem.IndexedDB.Create({}, (e, idbfs) => {
    idbfs.stat('/', true, function (err) {
      if (err) throw err;
    });
  });

Fixes #225

1j01 commented 6 years ago

I guess I'll close this and open a PR with just the OverlayFS change https://github.com/jvilk/BrowserFS/pull/241