isomorphic-git / lightning-fs

A lean and fast 'fs' for the browser
MIT License
493 stars 48 forks source link

Origin Private Filesystem (OPFS) support? #125

Closed matbee-eth closed 11 months ago

matbee-eth commented 11 months ago

Does this project support OPFS or does it need to be added?

jcubic commented 11 months ago

This project only supports fs created using indexedDB.

matbee-eth commented 11 months ago

I took a look last night and noticed that, so I'm working on an OPFS fork, thanks!

jcubic commented 11 months ago

You don't need to fork it, you will need to delete everything or implement a custom backend which is a library that works on its own together with lightning-fs.

matbee-eth commented 11 months ago

Incorrect wording, I meant an OPFS implementation. All good!

jcubic commented 11 months ago

I understand. Forking will give you no good. You will either implement everything from zero or create a custom OPFS backend, but custom backend is almost like implementing everything from scratch. You need to implement all methods like in NodeJS fs module. I never understood what is the purpose of custom backend. For me it looks like whole new implementation. Maybe without fs.promises interface that will be created automatically for you.

matbee-eth commented 11 months ago

Yep got it working by simply providing {promises:customopfs} to iso-git! Thanks so much! I'll post a link at some point soon, some minor complexity involved to get it working in webworkers but I solved it rather well imo. Just have to figure out how to sort it out as an NPM module.

inverted-capital commented 10 months ago

@matbee-eth please may we take a look ?

matbee-eth commented 10 months ago

@matbee-eth please may we take a look ?

Yeah I can post it in its raw state and you can take a look