Skip to content

element-script/praseodymium

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Praseodymium

Use .properties files in Node.js

Installation

npm i praseodymium

API

Initialize

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 values

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()

Set value

Reader.set('key','value')
Parameter Description
key The key to set the value of

Convert

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)

Other info

Need help? Ask a question on Github

Report feedback & bugs here

Like our work? Support us on Patreon

Releases

No releases published

Sponsor this project

Packages

No packages published