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

Provide access to local files - filesystem backend - use web File API #921

Closed
ieugen opened this issue Jan 2, 2023 · 3 comments
Closed

Comments

@ieugen
Copy link

ieugen commented Jan 2, 2023

Hi,

This has been discussed in the past but I believe a local file access is still very valuable and possible to implement.
See #93 .

Context:

I started using org-mode recently and tried organice a few times.
It hanged and did not perform well - web page was blank.
I was trying to do grocery shopping at the local flee market.
I can tell you, it was not a nice experience :) .

I also had to sign in to online service and/or use git - which creates a lot of commits.

I normally use Syncthing to synchronize files between laptop, servers and mobile phone. https://syncthing.net/
It works great, I am very happy with it (stopped using dropbox and gdrive, etc).
Local storage is much more reliable than internet connection.

Proposal:

I believe it should be possible to use organice with local files.

The web browser has File API https://developer.mozilla.org/en-US/docs/Web/API/File_API that can be used on all major platforms, including mobile devices: https://caniuse.com/?search=file .

It allows you to open a file and read it's contents.
There is an example that you can try out on your mobile, on the MDN page above.
I tried it on my Android 10 and I managed to open a local csv in my case.
I am sure the same could be used to open local org files and parse them.

There is also a guide on how to access files (and even list directories) https://web.dev/read-files/ .
It shows different techniques on how to open files.

I will see if I can find some time to check the code out and do POC / PR .
It would be nice if someone with more organice experience can check if my solution is viable.

Thanks,
Eugen

Related:

@ieugen
Copy link
Author

ieugen commented Jan 2, 2023

As I wrote this I realized that there is no JS API to write a file to disk from the browser.
There is the filesystem API that creates a virtual (isolated FS) but then the problem remains - how to sync to real filesystem https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API

Perhaps the browser could open a "Save as" dialog to "download" the content to the actual file.
But I imagine the UX would not be stellar.

Probably a good solution would be to package this web app as a native application and expose the FS API that way.
Has anyone tried doing that ?

@munen
Copy link
Collaborator

munen commented Jan 2, 2023

As I wrote this I realized that there is no JS API to write a file to disk from the browser.

exactly.

Has anyone tried doing that ?

check out the develop branch. Works for Android, already.

@munen
Copy link
Collaborator

munen commented Jan 2, 2023

Closing since you mentioned yourself that your proposal won’t work.

if you want to work on the native app branch, you’re very welcome to!

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

No branches or pull requests

2 participants