{"id":13817,"library":"properties","title":".properties Parser and Stringifier","description":"The `properties` package provides a comprehensive parser and stringifier for Java-style `.properties` files, including support for extended features such as INI-like sections, variable expansion (including references to environment variables), dot-separated namespaces, and file import directives. The current stable version is 1.2.1. Although the README once implied active development, the package's last update was over nine years ago, and its `engines.node` requirement (>=0.10) indicates it targets very old Node.js environments, suggesting it is now abandoned. It distinguishes itself by not only adhering to the core Java `.properties` specification but also by offering powerful, opt-in enhancements that allow for highly structured and dynamic configuration management, going beyond basic key-value pair parsing.","status":"abandoned","version":"1.2.1","language":"javascript","source_language":"en","source_url":"git://github.com/gagle/node-properties","tags":["javascript","properties","ini","parser","stringifier","config"],"install":[{"cmd":"npm install properties","lang":"bash","label":"npm"},{"cmd":"yarn add properties","lang":"bash","label":"yarn"},{"cmd":"pnpm add properties","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CommonJS-only and does not support ES module `import` syntax.","wrong":"import properties from 'properties';\nimport { parse } from 'properties';","symbol":"properties","correct":"const properties = require('properties');"},{"note":"The `parse` function is accessed as a method of the default CommonJS export.","wrong":"import { parse } from 'properties';\nparse(data, options, callback);","symbol":"parse","correct":"const properties = require('properties');\nproperties.parse(data, options, callback);"},{"note":"The `stringify` function is accessed as a method of the default CommonJS export.","wrong":"import { stringify } from 'properties';\nstringify(obj, options, callback);","symbol":"stringify","correct":"const properties = require('properties');\nproperties.stringify(obj, options, callback);"}],"quickstart":{"code":"const properties = require('properties');\nconst fs = require('fs');\nconst path = require('path');\n\nconst filePath = path.join(__dirname, 'config.properties');\nconst fileContent = `# Application Configuration\napp_name = MyWebApp\n\n[web]\nhostname = 127.0.0.1\nport = 3000\n\n[db]\nhostname = localhost\nport = 5432\nuser = admin\n`;\n\n// Create a dummy config file for parsing\nfs.writeFileSync(filePath, fileContent);\n\nproperties.parse(filePath, { path: true, sections: true, variables: true }, function (error, obj) {\n  if (error) {\n    console.error('Error parsing properties:', error);\n    return;\n  }\n  console.log('Parsed Configuration:');\n  console.log(obj);\n  // Expected output will include nested objects for sections\n  // { app_name: 'MyWebApp', web: { hostname: '127.0.0.1', port: 3000 }, db: { hostname: 'localhost', port: 5432, user: 'admin' } }\n  \n  // Clean up the dummy file\n  fs.unlinkSync(filePath);\n});","lang":"javascript","description":"Demonstrates parsing a `.properties` file from a file path, including support for INI-style sections and logging the resulting JavaScript object."},"warnings":[{"fix":"Always explicitly pass an options object to `properties.parse()` or `properties.stringify()`, for example: `{ sections: true, variables: true, namespaces: true }` to enable desired functionalities.","message":"Many advanced features like INI sections, variable expansion, and namespaces are opt-in. They must be explicitly enabled via options in the `parse` or `stringify` methods, as they are not active by default.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Thoroughly test compatibility in your specific environment before using in production. For new projects, consider using a more actively maintained `.properties` or general configuration parsing library that supports modern JavaScript ecosystems.","message":"This package is effectively abandoned (last updated 9+ years ago) and targets very old Node.js versions (>=0.10). It may not function correctly, have security vulnerabilities, or integrate well with modern Node.js environments (e.g., ESM-only projects, current dependency management, newer `fs` module behaviors).","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Rigorously sanitize and validate all input file paths when using `path: true` or the `include` option with user-supplied data to prevent malicious file system access.","message":"Using the `path: true` option or the `include` feature with untrusted file paths can introduce directory traversal vulnerabilities or arbitrary file read exploits, as it directly accesses the file system based on input.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'0.10':73 '1.2.1':51 'abandon':85 'activ':57 'adher':92 'ago':68 'allow':109 'also':100 'although':52 'basic':119 'beyond':118 'comprehens':10 'config':130 'configur':115 'core':95 'current':47 'develop':58 'direct':45 'distinguish':87 'dot':39 'dot-separ':38 'dynam':114 'engines.node':71 'enhanc':107 'environ':36,80 'expans':32 'extend':23 'featur':24 'file':19,43 'go':117 'high':111 'impli':56 'import':44 'includ':20,33 'indic':74 'ini':28,127 'ini-lik':27 'java':16,96 'java-styl':15 'javascript':125 'key':121 'key-valu':120 'last':62 'like':29 'manag':116 'namespac':41 'nine':66 'node.js':79 'offer':102 'old':78 'opt':105 'opt-in':104 'packag':7,60 'pair':123 'pars':124 'parser':2,11,128 'power':103 'properti':1,6,18,97,126 'provid':8 'readm':54 'refer':34 'requir':72 'section':30 'separ':40 'specif':98 'stabl':48 'stringifi':4,13,129 'structur':112 'style':17 'suggest':81 'support':21 'target':76 'updat':63 'valu':122 'variabl':31,37 'version':49 'year':67","created_at":"2026-04-20T01:56:28.004984+00:00","updated_at":"2026-04-20T01:56:28.004984+00:00","problems":[{"fix":"Use the CommonJS `require` syntax: `const properties = require('properties');` and then access the function as `properties.parse(data, options, callback);`.","cause":"This error typically occurs when attempting to use ES module `import` syntax (e.g., `import { parse } from 'properties'`) or incorrect destructuring in a CommonJS environment.","error":"TypeError: properties.parse is not a function"},{"fix":"Ensure the file path provided to `properties.parse` is correct and absolute or relative to the current working directory. Also, verify that the Node.js process has read permissions for the specified file.","cause":"When `path: true` is provided in the options, the first argument to `properties.parse` is interpreted as a file path. This error indicates that the specified file does not exist or the application lacks the necessary permissions to read it.","error":"Error: ENOENT: no such file or directory, open 'your/file/path.properties'"},{"fix":"Review your `.properties` file for syntax errors. If you are using advanced features, ensure the corresponding options (e.g., `sections: true`, `variables: true`, `namespaces: true`) are explicitly set in the options object for `properties.parse`.","cause":"The input `.properties` file contains syntax that is malformed or uses features (like INI sections, variables, or namespaces) that are not enabled via the options object passed to `properties.parse`.","error":"SyntaxError: Unexpected token { (or similar parsing errors)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.6.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/gagle/node-properties","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/properties","openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-18","install_tag":null}}