Storage - is there anything else than writing files to disk?

I’ve been searching a bit, and I cant really find anything about storing data on the device, except for Storage where u can write files to disk.

I was hoping for something more refined, like Androids SharedPreferences or perhaps SQlite, something where the data is organized and easy to write and access. Does Fuse have support for something like that?

Hi,

Oh yes.

For advanced filesystem access: https://www.fusetools.com/docs/fuse/filesystem/filesystemmodule

For databases, you need to use a third party SDK. For things like SQLite, there are community packages that wrap them in nice JS APIs: https://github.com/bolav/fuse-sqlite

For backend data:

https://appstax.com/docs/fuse-guide.html

Hope that helps :slight_smile:

Right, so no build in support in fuse other than writing files to disk then. No support for sharedprefs or the equivilient in ios?

Are there any plans for such support?

We try to limit the number of built-in packages (that can’t be stripped out) in favor of optional packages, like the SQLite package linked above. It works fine and is easy to use.

We don’t have any particular plans for sharedprefs at this moment, but it would similarly be easy to add as a community package.

I see. Well, im not sure why fuse decided to strip this important functionality and instead rely on a third party implementation, but i think its not the best of ideas.

I would suggest that something like the “sharedprefs” in Android is included in fuse by default and supported, as i see that as core functionality and its widely used, most apps use some persistent data.

Please at least consider it.

Thanks for input!

Regards

ted.ekeroth@gmail.com wrote:

I see. Well, im not sure why fuse decided to strip this important functionality and instead rely on a third party implementation, but i think its not the best of ideas.

I would suggest that something like the “sharedprefs” in Android is included in fuse by default and supported, as i see that as core functionality and its widely used, most apps use some persistent data.

Please at least consider it.

Thanks for input!

Regards

You are absolutley right !

Hi!

Looking at SharedPreferences in android and NSUserDefaults in iOS, i don’t see what this adds on top of simply storing a JSON file on disk using Fuse’s Storage or FileSystem APIs.

Granted, the Android version allows you to listen for changes, but this can easily be emulated by creating a wrapper module in plain JS.

Please enlighten me on what particular use case you feel is not covered by Fuse’s current APIs.

Well, its always easy to say “you can build a wrapper” or “you can create your own class/classes that fulfulls the requirements you have”. In theory, Im sure I could build, for example, my own ScrollView too (luckily, you did it for us), or build my own Observable class in JS somehow, but as I see it, a framework is there to make it easier for developers and to have a “complete support” for the most used things.

So, to have some basic support for storing stuff, cookies, authentication stuff or whatever, is standard. Its so standard and widely used that its strange not to support it.

To save to a file is not ideal; lets say you store a little more offline data. You dont wanna read in the whole file. Sure, you could start storing in different files and build your own little homemade “database”, storing in different files etc, but again, the framework is there to help.

The main point isnt, as I see it, “why” Fuse should support some basic persistent data handling, the question is “why not”? Isn’t it a normal occurence in any app development? Is there a reason why Fuse opted to leave that part out?

So far, I really like what Fuse can do, so I am just humbly suggesting improvements to make it better for the average developer out there =)

I take your point Ted, and I agree in principle. However, the reason it isn’t in there is that there are literally thousands of things that are on our “nice to have” list of features to add to Fuse, but we are a limited team to develop the core platform, and we need to prioritise. The features you are describing adds just a marginal benefit on top of the APIs we already support, and hence it will be low priority. I’m not saying we’ll never add it, but it’s not among the first things we will run and do.

It is however very easy to create and share community packages already, and with the upcoming Fuse package manager system, it will be even easier. So just because something is not bundled in the core platform, it doesn’t mean it is not supported in general.

Our vision for Fuse is that there should be a solid, yet compact core platform (to ensure small and fast minimal app exports), and an ecosystem of community packages which you can optionally link in to any project based on what you need. Note that the Fuse team also contributes lots of community packages already.

https://www.fusetools.com/docs/packages

Ok, i understand you have a lot on your list to do :slight_smile:
I will try to look into the third party stuff and see where that will lead.

Out of curiosity: when you write core functionality in fuse, what language do you write in?

Cool, looking forward to see some new packages :slight_smile:

The Fuse core is written in Uno, with foreign code (ObjC/Java) for interop with the native APIs.

FuseJS (the Fuse JavaScript standard library) is written in a mix of JavaScript and Uno.

You can read more about Uno here: https://www.fusetools.com/docs/native-interop/native-interop