Git Product home page Git Product logo

Comments (10)

jcubic avatar jcubic commented on May 28, 2024

I think the easiest way is to look at lightningFS library that implements fs module that can be used in web browser.
But to have custom fs you need to implement custom backend.

from isomorphic-git.

bajrangCoder avatar bajrangCoder commented on May 28, 2024

Ok Thanks for your response!
Can I get some hints or any sample of implementing custom backed? As on lightningFS library only mention about backend but there is no any docs or example about it

from isomorphic-git.

jcubic avatar jcubic commented on May 28, 2024

There is information in README: Providing a custom backend (advanced usage). The sad thing is that the custom backend is almost like an entirely new implementation of fs.

I've added a way to swap Key/Value pair (db option) in lightning-fs, and was always wondering what is the point of custom backend if it's like your own lightning-fs library.

from isomorphic-git.

bajrangCoder avatar bajrangCoder commented on May 28, 2024

I have seen it but how I will pass my custom IBackend as it mentioned in readme that I will need to pass on option backend option but there is no any backend option in option interface

The sad thing is that the custom backend is almost like an entirely new implementation of fs.

Yes it's totally like having a own fs

from isomorphic-git.

jcubic avatar jcubic commented on May 28, 2024

It seems there is an option backend:

https://github.com/isomorphic-git/lightning-fs/blob/main/src/PromisifiedFS.js#L82C29-L82C36

But it's not in TypeScript definition. If you don't use TypeScript you can try it. And if you use TypeScript maybe you will need to put as any somewhere.

from isomorphic-git.

bajrangCoder avatar bajrangCoder commented on May 28, 2024

Yeah there are some issues in lightning fs typings declaration file as it makes db option required. For now I have modified it and tested fs.promises.readdir()and it's worked after doing some bypassings.

And I want to ask that how can I overide the default function that disturb the filepath as in my case when I pass these type of paths : content://com.externalstorage....../ then lighting fs convert this path to this : ./content:/com......
As it will be needed in any case for my use case it's not required

Also noticed one error that occurs when ever I start my app but it doesn't the affect any thing , here is the screenshot of error:

Screenshot_20231026-153617~2

Note
I initialise the lighting fs in constructor like this 👇

constructor() {
  const customBackend = new FsBackend();
  this.fs = new FS();
  this.fs.promises.init("myfs", { backend: customBackend });
}

from isomorphic-git.

jcubic avatar jcubic commented on May 28, 2024

Don't call the init function it's an internal method.

from isomorphic-git.

bajrangCoder avatar bajrangCoder commented on May 28, 2024

Ok but what about this one 👇

And I want to ask that how can I overide the default function that disturb the filepath as in my case when I pass these type of paths : content://com.externalstorage....../ then lighting fs convert this path to this : ./content:/com......
As it will be needed in any case for my use case it's not required

Edit: I have used like this but still same error:

this.fs = new FS("myfs", { backend: customBackend });

from isomorphic-git.

jcubic avatar jcubic commented on May 28, 2024

I think that it will be much simpler to just implement your own fs and all the methods that are required. But if you would like to use lightning-fs you will need to fork it and modify to not normalize the path (or whatever function it used for paths).

from isomorphic-git.

bajrangCoder avatar bajrangCoder commented on May 28, 2024

Ok

from isomorphic-git.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.