{"name":"properties-reader","description":"Properties file reader for Node.js","version":"2.2.0","author":{"name":"Steve King","email":"steve@mydev.co"},"contributors":[{"name":"Steve King","email":"steve@mydev.co"},{"name":"Aureliano Bergese","email":"onailerua@hotmail.coom"}],"dependencies":{"mkdirp":"^1.0.4"},"devDependencies":{"jest":"^26.6.3"},"keywords":["properties","ini","parser"],"repository":{"type":"git","url":"git://github.com/steveukx/properties.git"},"main":"src/properties-reader-factory","scripts":{"preversion":"npm test","postversion":"npm publish && git push && git push --tags","test":"jest --coverage"},"engines":{"node":">=10"},"license":"MIT","jest":{"roots":["<rootDir>/src/","<rootDir>/test/"],"coverageThreshold":{"global":{"branches":80,"functions":80,"lines":80,"statements":80}},"coveragePathIgnorePatterns":["<rootDir>/test/"],"coverageReporters":["json","lcov","text","clover"],"testMatch":["**/test/**/*.spec.*"]},"gitHead":"a79ef3b8795a4627160d9b8e14ba77892ad9698c","bugs":{"url":"https://github.com/steveukx/properties/issues"},"homepage":"https://github.com/steveukx/properties#readme","_id":"properties-reader@2.2.0","_nodeVersion":"12.16.2","_npmVersion":"6.14.4","dist":{"integrity":"sha512-CgVcr8MwGoBKK24r9TwHfZkLLaNFHQ6y4wgT9w/XzdpacOOi5ciH4hcuLechSDAwXsfrGQtI2JTutY2djOx2Ow==","shasum":"41d837fe143d8d5f2386b6a869a1975c0b2c595c","tarball":"http://registry-npm.ywwl.com/properties-reader/download/properties-reader-2.2.0.tgz","fileCount":7,"unpackedSize":20042,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf7CZ4CRA9TVsSAnZWagAAmOoP/j0Dki0VAVrLN4DQulWw\nK5TkRs4C+V8ATjI43RjD+JSPFGukXyw2nLi3mS7Mq9LJTOwrIUXxtCObtYKd\nGcm6ApVxHKKTmYrsLdRSVMJZL3NgfTOyLxA7DMP4XHoWp6ocPRYUOhe602sD\nbS87GnZgOVpD7fssxMq8WXS4kXNxtzKZbRvRIiYgsgXVYVXg0KecGpxLIsYh\nYWOP7DgH+YFSXYam42xCjpDFaqcLekTkJaW3+RSWBNTzVAg6slkOrRE5Mr8W\nLy0ZykYewyPsE9xJe0J0EAvN1URCGyECaL5eyTEXCDj3FiQ5d/6okmiaiyxS\nyG/RYjgVdEkr98OkXP6TtfjnHvAWts8y5GDh3x5gUgai3yFLmaxbGzhxSBf4\nyVyDGaZHzKMRLrJuVsxVA4Rl/zIbHVmmyMlR/RSzGrVf+kOt0oaIGj6FQt/i\n3NM93AXlQ4ttcuptJY4YfIeePeNgoonvaoeLGh5CGUly3o+zE5SAbULR/49r\njugzumzSvP66gixFgXK5kuTuuDGx4+Kbxl2SeXUCoD48Tn0Eu0Vfe+Wj+j6Q\n3shYzLCM23LPGhi5jX9yd8x3KTPSGTaE16CozSgQXM7W4ZHodEHyFSnxi8eM\n1ApfWp3GvfPp7UzuB++tDdZ+QeCK3i0AOzybexvb3EpSdGVPjsVaAMhQpY02\ntVow\r\n=dWyF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAUx9V44cZwSjoxvv8kuSqUBMHEsbGo2ECcY6bNQqVKiAiEAnvuURcqp3xH3M/sCW19eR6xvPOvJrDfosSvhdJ7CrTQ="}],"size":6698,"noattachment":false,"key":"/properties-reader/-/properties-reader-2.2.0.tgz"},"_npmUser":{"name":"steveukx","email":"steve@mydev.co"},"directories":{},"maintainers":[{"name":"steveukx","email":"steve@mydev.co"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/properties-reader_2.2.0_1609311863631_0.0025518898048981775"},"_hasShrinkwrap":false,"readme":"Properties-Reader\n=================\n\nAn ini file compatible properties reader for [Node.JS](http://nodejs.org)\n\nInstallation\n============\n\nThe easiest installation is through [NPM](http://npmjs.org):\n\n    npm install properties-reader\n\nAPI\n===\n\nRead properties from a file:\n\n    var propertiesReader = require('properties-reader');\n    var properties = propertiesReader('/path/to/properties.file');\n\nThe properties are then accessible either by fully qualified name, or if the property names are in dot-delimited\nnotation, they can be access as an object:\n\n    // fully qualified name\n    var property = properties.get('some.property.name');\n\n    // by object path\n    var property = properties.path().some.property.name;\n\nTo read more than one file, chain calls to the `.append()` method:\n\n    properties.append('/another.file').append('/yet/another.file');\n\nTo read properties from a string, use the `.read()` method:\n\n    properties.read('some.property = Value \\n another.property = Another Value');\n\nTo set a single property into the properties object, use `.set()`:\n\n    properties.set('property.name', 'Property Value');\n\nWhen reading a `.ini` file, sections are created by having a line that contains just a section name in square\nbrackets. The section name is then prefixed to all property names that follow it until another section name is found\nto replace the current section.\n\n    # contents of properties file\n    [main]\n    some.thing = foo\n\n    [blah]\n    some.thing = bar\n\n    // reading these back from the properties reader\n    properties.get('main.some.thing') == 'foo';\n    properties.get('blah.some.thing') == 'bar';\n    \n    // looping through the properties reader\n    properties.each((key, value) => {\n      // called for each item in the reader,\n      // first with key=main.some.thing, value=foo\n      // next with key=blah.some.thing, value=bar\n    });\n    \n    // get all properties at once\n    expect(properties.getAllProperties()).toEqual({\n      'main.some.thing': 'foo',\n      'blah.some.thing': 'bar',\n    })\n    \n\nChecking for the current number of properties that have been read into the reader:\n\n    var propertiesCount = properties.length;\n\nThe length is calculated on request, so if accessing this in a loop an efficiency would be achieved by caching the\nvalue.\n\nWhen duplicate names are found in the properties, the first one read will be replaced with the later one.\n\nTo get the complete set of properties, either loop through them with the `.each((key, value) => {})` iterator or\nuse the convenience method `getAllProperties` to return the complete set of flattened properties. \n\n### Saving changes\n\nOnce a file has been read and changes made, saving those changes to another file is as simple as running:\n\n```javascript\n// async/await ES6\nconst propertiesReader = require('properties-reader');\nconst props = propertiesReader(filePath, {writer: { saveSections: true }});\nawait props.save(filePath);\n\n// ES5 callback styles\nprops.save(filePath, function then(err, data) { ... });\n\n// ES5 promise style\nprops.save(filePath).then(onSaved, onSaveError);\n```\n\nTo output the properties without any section headings, set the `saveSections` option to `false`\n\nData Types\n==========\n\nProperties will automatically be converted to their regular data types when they represent true/false or numeric\nvalues. To get the original value without any parsing / type coercion applied, use `properties.getRaw('path.to.prop')`.\n\nFAQ / Breaking Changes\n======================\n\n## Duplicate Section Headings\n\nFrom version `2.0.0` the default behaviour relating to multiple `[section]` blocks with the same name has changed\nso combine the items of each same-named section into the one section. This is only visible when saving the items\n(via `reader.save()`).\n\nTo restore the previous behaviour which would allow duplicate `[...]` blocks to be created, supply an appender\nconfiguration with the property `allowDuplicateSections` set to `true`.\n\n```javascript\nconst propertiesReader = require('properties-reader');\nconst props = propertiesReader(filePath, 'utf-8', { allowDuplicateSections: true });\n```\n\nContributions\n=============\n\nIf you find bugs or want to change functionality, feel free to fork and pull request.\n\n","publish_time":1609311863740,"_cnpm_publish_time":1609311863740,"dist-tags":{"latest":"3.0.1"}}