
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
java-props
Advanced tools
Read Java .properties files (using the same specification), without useless additional features.
Read/Parse Java .properties files (using the same specification) in Javascript / Node.js.
Note for TypeScript users: This module build and provide its TypeScript declarations files (.d.ts).
Node.js · Install the module with:
npm i --save java-props
# file.properties
a = Hello World
b : Node.js\u00AE
c value
d=foo\
bar
const javaProps = require('java-props');
javaProps.parseFile('./file.properties').then((props) => {
console.log(props);
// { a: 'Hello World', b: 'Node.js®', c: 'value', d: 'foobar' }
}).catch((err) => {
console.error(err)
});
Example
const javaProps = require('java-props');
Object
Promise.<Object>
Object
Parses a .properties string, constructing a corresponding JavaScript object.
Returns: Object
- The Object corresponding to the given string
Param | Type | Description |
---|---|---|
str | String | The string to parse as .properties |
Example
const props = javaProps.parse('foo=Hello\nbar=World');
console.log(props.foo + ' ' + props.bar);
// "Hello World"
Promise.<Object>
Parses a .properties file, constructing a corresponding JavaScript object.
Returns: Promise.<Object>
- The Object corresponding to the given string
Param | Type | Default | Description |
---|---|---|---|
path | String | Buffer | URL | number | Filename or file descriptor | |
[encoding] | String | utf8 | File encoding |
Example
javaProps.parseFile('./foobar.properties').then((props) => {
console.log(props.foo + ' ' + props.bar);
// "Hello World"
}).catch((err) => {
console.error(err);
});
- or with async/await -
async function fct() {
try {
const props = await javaProps.parseFile('./foobar.properties');
console.log(props.foo + ' ' + props.bar);
// "Hello World"
} catch (err) {
console.error(err);
}
}
This project uses TypeScript. To create javascript sources run:
npm run build
To generate the documentation, edit documentation.js
then run:
# npm install -g jsdoc-to-markdown
jsdoc2md --partial doc/scope.hbs --files doc/documentation.js --heading-depth 3 | xclip -selection c
and copy the result inside this README.
Run the unit tests (no need to run build before, they use the typescript files):
npm run test
Contributions are welcome. Unfortunately there is no documentation on the codestyle yet, so look at the existing sources and do the same.
The goal is to keep a simple project without unnecessary (non essential) features. Don't hesitate to open an issue before to discuss about your idea.
We use SemVer for versioning. For the versions available, see the tags on this repository.
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Read Java .properties files (using the same specification), without useless additional features.
The npm package java-props receives a total of 4,709 weekly downloads. As such, java-props popularity was classified as popular.
We found that java-props demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.