Comments (10)
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.
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.
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.
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.
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.
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:
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.
Don't call the init function it's an internal method.
from isomorphic-git.
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.
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.
Ok
from isomorphic-git.
Related Issues (20)
- The `statusMatrix` throw a TypeError when use in the browser with `memfs` HOT 4
- Git.readBlob is too slow. HOT 9
- Properly propagate error encountered when reading response from git-upload-pack POST request HOT 4
- No shallow directory error HOT 3
- isPromiseFs fails on Deno HOT 9
- Improve `normalizePath` performance HOT 6
- pushing a tag to a target branch fail HOT 1
- Empty response from git server when using code bundler HOT 33
- Pushing returning 401 Error: No Anonymous Write Access HOT 6
- Tests are failing on Android HOT 15
- Cloning empty repository fails if git server uses git >= 2.41.0 HOT 5
- Getting a 404 with azure devops HOT 1
- not respecting server capabilities ( report-status ) HOT 1
- How can I abort a push operation on Node? AbortController seems to be not supported. HOT 2
- Codespell workflow needs approval
- Disable failing test that require credentials on Azure DevOps HOT 14
- Race condition makes it possible for a ref to be resolved to an empty string while it's in the middle of being updated HOT 16
- Invalid refs should throw HOT 11
- Isomorphic git functionality is broken on any browser
- Error Running Linter on main locally HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from isomorphic-git.