Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate backends #369

Closed
james-pre opened this issue Sep 10, 2023 · 7 comments
Closed

Separate backends #369

james-pre opened this issue Sep 10, 2023 · 7 comments
Assignees
Milestone

Comments

@james-pre
Copy link
Collaborator

Backends should be separated into different NPM packages so users don't have to import needed backends:

NPM package Description
@browserfs/core Includes the core code for BrowserFS and these backends: InMemory, MountableFileSystem, OverlayFS, AsyncMirror, FolderAdapter
@browserfs/fetch Fetch/HTTPRequest/XMLHTTPRequest backend
@browserfs/dom Backends which require DOM APIs (i.e. LocalStorage and IndexedDB)
@browserfs/emscripten Emscripten backend
@browserfs/zip ZipFS backend (will be updated to include explode, unreduce, and unshrink)
@browserfs/iso IsoFS backend
@browserfs/dropbox Dropbox backend

Note that ownership of the @browserfs organization on NPM is pending and this would resolve #233 and #200.

@james-pre james-pre added this to the 2.0 milestone Sep 10, 2023
@james-pre james-pre self-assigned this Sep 10, 2023
@zardoy
Copy link

zardoy commented Feb 26, 2024

@james-pre Hey! I'm sorry to ask you again, to where I can find a new repo for the remote backend (dropbox)? I want to implement google drive backend as I really need it. If there is anything I can do for you please let me know. thx
also waiting for npm packages to be published!

@james-pre
Copy link
Collaborator Author

@zardoy,

I made the decision not to include any backends for 3rd party services since it was already a huge amount of work splitting up the codebase, rewriting the internal API to use promises, and writing the compatibility for fs promises. Once BFS is up to Node 20 compatibility, I would work on other backends.

If you want, I would love a PR for the Dropbox backend that brings it up to the current BFS internal API.

Thanks.

@zardoy
Copy link

zardoy commented Mar 13, 2024

@james-pre

I made the decision not to include any backends for 3rd party

I think it would be enough to just include some generic blackened that would be easy to extend so you can just fill the required implementation for operations like reading directories and files. Though I believe these 3rd party backends might be quite popular I think it would be better to have official support for them.

Once BFS is up to Node 20 compatibility, I would work on other backends.

Have any roadmap or timetable? I'm looking forward to this happening!

If you want, I would love a PR for the Dropbox backend that brings it up to the current BFS internal API.

Sorry I don't need Dropbox backend, but here I implemented a Google Drive backend: https://github.com/zardoy/browserfs/blob/google-drive/src/backends/GoogleDrive.ts (and already tested a bit)

also btw I wanted to support old Node.js API so I added back callback-style support in API

EDIT: sorry for the delay, didn't have much time to finish the Google Drive backend, now I need to cleanup all that somehow :)

@james-pre
Copy link
Collaborator Author

I agree with you, I just haven't implemented the 3rd party backends.

As for your callback based backend, the backends must implement the internal BFS API (using promises). The compatibility/emulation part of the code then adds the full Node callback API, among other things.

I don't have any exact times for when I want to get things done, since I work on BFS in my free time (which can vary widely).

Thank you for all the interest!

@james-pre
Copy link
Collaborator Author

@zardoy,

I think BFS/core has gotten to a really good point for me to look into implementing the 3rd party backends. First, I want to overhaul the other packages (DOM, Fetch, Worker, Zip, Iso, etc.).

Maybe I can look into implementing them in the next month or so?

@zardoy
Copy link

zardoy commented Mar 15, 2024

IMO it would be much better to support all core features first. For example I'm still eagerly waiting for latest Node.js to be supported (for some things I personally do workarounds like https://github.com/zardoy/prismarine-web-client/blob/f16dbdd61f5b524c892d3da9bfa78f5b18ed13d8/src/browserfs.ts#L33)
On the other hand I'm really interested in zipfs as this the the backend I use most.

@zardoy
Copy link

zardoy commented Mar 15, 2024

Maybe I can look into implementing them in the next month or so?

Anyway
It would so cool! Looking forward to it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants