How should I save the contents of the ini file

Hello Everyone,

I'm completely new to node-red and javascript.
I have an ini file that defines the configuration of the Node-RED application created by the user and can change the value.

After reading the contents of the ini file, I think I will save it to a global class and then the nodes will call and retrieve data from this global class.

For Node-RED, is it right or should I do it in this case, please help tell me!
Any hint will be great.

Can you give us an idea of what is stored in the file so we can better understand the context?

1 Like

If I understand you, you have settings that are to be used in a flow, stored in an INI file that you want node-red to read?

I guess you mean, store the INI values in an object in node-red for quick / easy access to setting values??

IMO, NO - I would NOT recommend an INI file.

JavaScript works much better with JSON (which stands for JavaScript Object Notation)

Here is an example of the difference...




  global: {
    max_users: 12,
    title: "hello",
    dept: "office1"
    ep1: "http://docs.local"
  • The INI would have to be specially parsed / converted to a JS object with properties. (DIFFICULT+SLOW)
  • The JSON file would import directly into JS object with properties. (SIMPLE+FAST)

Mind you - if you MUST stay on INI files, this might work for you (I have never used it)

1 Like

The contents of the ini file look like this:



Key1=ValueA  // Because the same [GROUP1] and Key1 should ignore not storing data



Because user want to use ini file.... :frowning:

If I use JSON file, how should I save the data? Can you hint for me?

Same way you would save an ini file.

JSON is just text

JSON = JavaScript Object Notation

i.e. a string representation of a JS object.

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