Store message in persistent file system without mentioning "storeName"

Hello All,
I have a requirement to maintain data in both memory and file based context(if not present in memory copy from file based context; if not present in file copy from memory based context).
Generally the context mapping in settings.js looks like the following;

contextStorage: {
	storeInFile: { module: "localfilesystem"},
    	default    : { module: "memory" }

To store data to file based context I need to provide flow.set(data, "storeInFile"), but in another node red environment the instead of "storeInFile" someone can use "file" or "fileBased" etc.
Since I have my "default" key mapped to memory, Is there any way I can use file based storage without mentioning the key name("storeInFile", "file" or "fileBased")?

Thanks in advance

If you donā€™t specify the name it uses the default.

@dceejay Yes, in my case default is memory and I want to keep that way.
For now what I did is; get context data using RED object and check any "key" has value {module:"localfilesystem"}, I store that value in my node and provide that while setting flow context. So the key name does not matter it can be "storeInFile", "file" or "fileBased".

Yet to find a refined solutionšŸ˜‰

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.