
BrowserFS: an in-browser filesystem with many back ends - setra
https://github.com/jvilk/BrowserFS
======
rektide
I'm a huge fan of the work here & strongly strongly believe in file-system
oriented architectures.

Being able to use a wide number of existing "server side" libraries in the
browser could be a huge win.

And this has interesting server side applications too, where one can use the
same Node.js code but target diverse & interesting backends & overlayed
systems. Having a virtual-fs is an incredibly powerful and useful concept.

"Everything is a file!" still sounds like a great idea.

Alas _BrowserFS lacks Streams support._ Given how async oriented and streams
based a lot of new JS tends to be, that is a huge sticking point for me, and a
glaring exception that will rule out using a very sizable number of existing
packages that otherwise would benefit greatly from BrowserFS. Issue 124,
Support streams:
[https://github.com/jvilk/BrowserFS/issues/124](https://github.com/jvilk/BrowserFS/issues/124)

As an alternative: it lacks the flexible, pluggible/mountable backend of
BrowserFS, but level-filesystem does do streams, and can be run in the browser
(when combined with level-up): [https://github.com/mafintosh/level-
filesystem](https://github.com/mafintosh/level-filesystem)

Final aside, I always thought it would have been cool if the virtual file
abstraction that the Gulp build tool built - Vinyl - had started getting used
outside Gulp. Theres no file-system model, just a file model here, except for
implicitly in that files have paths, but with some mapping one can imagine
making something like BrowserFS or other with the Vinyl model. That said, I
think John has done a great job with his rigorous, TypeScript-ed object model
in BrowserFS.
[https://www.npmjs.com/package/vinyl](https://www.npmjs.com/package/vinyl)

Here's to hoping #124 - Streams Support - sees some progress. Great library
John!

~~~
jvilk
Thanks, rektide! Streams support haven't been added since a) there hasn't
appeared to be great demand from folks using the library, and b) I haven't
needed it for any project at all.

Feel free to leave comments on the issue if you or others would like to use
BrowserFS but have been dissuaded because it lacks streams. I'm interested in
your use cases. If your files are relatively small, then basic stream support
can be bolted on with 100% preloaded files. If they are larger, then it would
require a larger effort to bolt on incremental file loading into each backend
to support streams.

------
nathancahill
For those new to the project: this is the file system that's used alongside
Doppio, written by the same John Vilk. Both projects are excellent examples of
large Typescript projects, the code is very well documented and readable.

~~~
rektide
For those new to Doppio, it's a JVM in TypeScript, useful for ex for running
Java code in the browser. :)

~~~
IgorPartola
What the heck? That's a thing you can do now? I just really wish someone time-
travelled this back to like 2001 when people were still confused about Java vs
JavaScript and MS had their own JVM implementation.

In seriousness, is the performance of Doppio bearable? Also, what are the use
cases for a thing like that?

~~~
jvilk
Performance is 24-40x over the HotSpot (Oracle Java) interpreter on compute-
intensive benchmarks. The primary use case is for non-compute intensive code.

[http://www.codemoo.com/](http://www.codemoo.com/) uses it to teach students
basic Java in a game format.

~~~
mishac
Sorry do you mean it's 24 times slower? 24x performance makes it sound like
it's 24x faster, which doesn't seem like it could possibly be true.

~~~
angli
Yes, slower. 24x faster would be a miracle!

------
_pdp_
For the past 6 months my startup has been compiling everything from node into
browser - emulating a lot of the node's APIs along the way and frankly it has
been a godsend in terms of testability, readability and modularization.

BrowserFS is yet another module to consider to add as part of this toolchain
which will help us stick to the basics instead of reinventing the wheel.
Unfortunately, there is no S3 backend at the moment but by having a quick look
at memory backend it may be an easy thing to add.

------
0b01
so you can use webpack to build react applications in browser? Structor should
look into that and integrate with their GUI

------
sintaxi
Awesome! This would be a welcomed addition to browsers as far as I'm
concerned.

~~~
scriptproof
The work on that has been discontinued by W3C ([https://www.w3.org/TR/file-
system-api/](https://www.w3.org/TR/file-system-api/)), so we have to rely on
extensions... It is a useful tool however, it could have saved me a lot of
time if available earlier.

------
aakilfernandes
Very cool!

------
ryanmccullagh
Is this an actual file system, or a file explorer? Big difference as far as
I'm concerned.

~~~
dsp1234
From the first line of the linked page, "BrowserFS is an in-browser filesystem
that emulates the Node JS filesystem API and supports storing and retrieving
files from various backends."

~~~
_cronjob
Ordinarily, there's a hard cross-orgin security policy separating URLs like:

    
    
      file:///Users/user/plain.txt
    

From:

    
    
      http://example.com/plain.txt
    

I feel like something that blurs this boundary could be dangerous for non-
developers and less techincal folks.

Things like Flash and Java applets often bridged that gap, causing many
problems.

I wonder how many people understand the reasons for a clear distinction
between browsing files on your machine with an FS explorer, versus an isolated
file store jailed or sandboxed to the browser?

~~~
vertex-four
This... doesn't do that. As evident in the README. It's a VFS API across a
bunch of things you could do anyway.

