humphd / humphd/next

Allow mounting of local filesystem into the editor.

Open
#61 3 comments 0 reactions 4 assignees Claimed by @mmBabol View on GitHub
discussion editor enhancement filesystem server
Dominant language
JavaScript
Stars
14
Forks
5
PR merge metrics
No merged PRs in 30d

Description

It would be very useful to be able to open local files in the online editor instead of the emulated ones.
I believe this could be achieve through the following steps;
1. Create an option on editor UI to switch to the local filesystem. Now, since js is sandboxed inside a browser, we will require user to suply string path to the folder to be opened.
2. At this point, we will need to refresh the editor and switch references to the fs from Filer to our custom implementation [here](https://github.com/humphd/next/blob/94dc23ef428ea60fc0ba5b6d8e3f151325a0577c/src/editor/src/bramble/client/main.js#L153) and [here](https://github.com/humphd/next/blob/94dc23ef428ea60fc0ba5b6d8e3f151325a0577c/src/editor/src/bramble/client/main.js#L232).
3. As mentioned above, js is restricted from accessing local fs directly. Instead, we can have a [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) passing messages between local server and bramble. Similar to how thimble communicates with bramble.
4. Our local server could be a simple exepress server. It would implement routes like `/local_fs/readfile`, `/local_fs/readdir?recursive=true`, similar things for writing to file and dir.
5. Local exepress server would pass binary streams from and to WebSocket simulating connection to local fs.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.