ICFS: Internet Computer File System

I’ve been working on a file system abstraction on top of stable memory for a while now and think I’ve made enough progress to share it more broadly.

It’s designed to be used with existing Rust crates, so the icfs crate only provides an implementation for the Read, Write, and Seek traits.

At the moment there’s an icfs-fatfs crate for use with fatfs. I also started working on support for the ext4 crate, if only to demonstrate how this could be used to support different types of file system.

Since the stable memory API requires a running canister, tests are implemented via ic-repl.

Please take a look and let me know if you have any feedback.

25 Likes

Are there any plans for a motoko module as well?

I’m curious what you envision the primary use case of this is.

Do you plan for canisters to use this to directly write to files, or is this better thought of as “glue code” to allow canister developers to use Rust libraries that rely on a filesystem to work (e.g. SQLite)?

There aren’t. I’m able to leverage existing crates that have already implemented file systems like FAT and ext4. A Motoko version would require implementing those as well.

1 Like

Either/or. There’s existing Rust code that wants to work with files and expects Read + Write + Seek that this opens up possibilities for.