# Store message in persistent file system without mentioning "storeName"

**URL:** <https://discourse.nodered.org/t/store-message-in-persistent-file-system-without-mentioning-storename/62377>\
**Category:** General\
**Created:** [9 May 2022 04:24 UTC](https://discourse.nodered.org/t/store-message-in-persistent-file-system-without-mentioning-storename/62377 "2022-05-09T04:24:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aswink](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@aswink](https://discourse.nodered.org/u/aswink)\
**Post date:** [9 May 2022 04:24 UTC](https://discourse.nodered.org/t/store-message-in-persistent-file-system-without-mentioning-storename/62377/1 "2022-05-09T04:24:33Z")

</div>

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;

```auto
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

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [9 May 2022 05:58 UTC](https://discourse.nodered.org/t/store-message-in-persistent-file-system-without-mentioning-storename/62377/2 "2022-05-09T05:58:04Z")

</div>

If you don’t specify the name it uses the default.

---

<div class="post-metadata">

**Author:** ![aswink](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@aswink](https://discourse.nodered.org/u/aswink)\
**Post date:** [9 May 2022 14:51 UTC](https://discourse.nodered.org/t/store-message-in-persistent-file-system-without-mentioning-storename/62377/3 "2022-05-09T14:51:25Z")

</div>

@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😉

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [8 July 2022 14:51 UTC](https://discourse.nodered.org/t/store-message-in-persistent-file-system-without-mentioning-storename/62377/4 "2022-07-08T14:51:54Z")

</div>

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