steveukx / properties

Properties reader for Node.js
MIT License
77 stars 33 forks source link

How to read other format nls files? #31

Closed ShrekHuo closed 4 years ago

ShrekHuo commented 4 years ago

How to read other format nls files? Like test.js, in the test.js, there are some key and value like below format: ({ key1: "value1", key2: "value2", }) Thanks.

steveukx commented 4 years ago

Hi, this library is only really aimed at parsing .ini / .properties formatted files. For a JSON structure (as in your question), you should be able to either require('./test') the file directly or pass the content through JSON.parse(FS.readFileSync('./test.json', 'utf8')).