Proper way to save user data and config

Im not sure if there is a size limit for config entries and if they are the proper way to save data.

In the scope of my extension the user may create multiple (as many as they want) generally small but may hit a couple kbs or larger.

Reading the API docs I feel that saving my data in separate JSON files is more manageable for the users of the extension.

Im leaning into using a user centric location like “~/Library/Application\ Support/Nova”, to save the extensions files.

Any suggestions or pointers will be appreciated?

I don’t think there’s a set limit on the size of the config entries. As far as I know they’re all stored in ~/Library/Application\ Support/Nova/UserConfiguration.json so you should be fine. Excessively large config options could cause a potential slow-down whenever the config is reloaded (probably just during activation/deactivation), but I doubt it’d be a serious problem.

I’m pretty sure you can safely use the Configuration API, either through nova.config, or more likely nova.workspace.config. That’s at least what I’d recommend as the initial approach. If you run into issues I’m sure you can change the approach later :slight_smile:

1 Like

Kristófer is correct. While there isn’t a specific limit on the size of configuration keys, I would recommend not making them too large, as as mentioned it could potentially slow down configuration file loading and manipulation.

If you want to store arbitrary amounts of data for your extension, there are a few folder locations provided by default:

nova.extension.globalStoragePath (see here) is a folder where you can store global data that isn’t specific to a project (e.g. things your extension might need to compute or download and cache globally)

nova.extension.workspaceStoragePath (see here) is a folder where you can store project-specific data. This folder is not stored in the project itself, and isn’t at risk of being committed to SCM.

1 Like

That’s actually the route I took. Im using “globalStoragePath”.