npm i praseodymium
Initialize by calling new propertiesReader()
. ECMAScript import
is also supported.
const propertiesReader = require('praseodymium')
const Reader = new propertiesReader('/file/path', { separatedBy:"=" })
Parameter | Description |
---|---|
File | The file path to read |
advanced.separatedBy | Change what key/values are separated by (default: =) |
Get one
Reader.get('key')
Parameter | Description |
---|---|
key | The key to get the value of |
Get all
Reader.getAll()
Get raw content as a string
Reader.getRaw()
Reader.set('key','value')
Parameter | Description |
---|---|
key | The key to set the value of |
Convert to JSON
Reader.toJSON()
Convert to an Array
Reader.toArray()
Convert a JSON object to the .properties
file syntax
Reader.toProperties({ key:"value" }, "output")
Parameter | Description |
---|---|
source | Object to convert |
output | Path to output file (optional) |
Need help? Ask a question on Github
Report feedback & bugs here
Like our work? Support us on Patreon