A Filesystem in JavaScript 🐣

It's Friday, it's nearly my Birthday, it's time to address some long running iterative projects (projects I never finish) LRIP for short 🪦.

What's my latest LRIP?

I have a bunch of these projects which I may one day finish.
One in particular which I really wanted to make possible but have been less experienced in previous iterations, a virtual file system.

In my mind Unix probably works in these easy to understand steps

The kernel 🐣🍗 is the entry point of an application (aka your computer) which a Filesystem sits on top of, the kernel provides syscalls to do things like change directories, write files and so on, these syscalls are usually C functions (that's it, no magic, although FYI Rust 🦀 is entering the chat).

Okay so we got functions, an application and how do we use this application?

How do you use your computer without a GUI? That's a trick, don't answer that because terminal is graphical, kind of... But yes a terminal, but the shell, that's what we are talking about.

Think of the most basic shell... Shell not Bash, just Shell, it's just a parser really, type 'cd' and the shell parses your input, cd is not in your bin it's a syscall chdir(), cool right? 😴, Wake up ☺️

Okay sleepy head

Get to the point, what do I need a Filesystem written bin JavaScript for, it sounds useless. Precisely, this filesystem offers nothing more than the bear bones 🐻 to represent a Filesystem, it's going to have a lot of extension points (plug-in a function) allowing library authors to represent a Filesystem as a data structure.

Here are some ideas:

  • A web server / application with a limited and synced to phisical disk
  • Some sort of mock FS testing
  • Deploy a yeoman style template in node.js
  • Build an OS real or otherwise
  • Build the next docker 😅
  • Browser mock FS
  • Wasm FS thing
  • hybrid synchronized FS
  • some new build system concept
  • Port it to Rust
  • Make it work on a real disk (it's possible with Fuse)

So I'm on my phone, I can't go explaining the code because it's not done yet, BUT it's intuitive I feel, also it's locked down as much as possible so that only a new Shell() can actually interact with the FS just like the real thing.

Such a fun toy, want to help me, get in touch we can FOSS it 🦄

24