properties
properties copied to clipboard
Allow reading the properties from a URL
The current implementation, using the fs
module, allows the properties file to be read only from the local file system. A use case I came across needed to access the properties file across a network, via http/https. Could this be added easily enough, or is it too much work or not appropriate?
Hi, while it's not explicitly permitted in the API - you can replace the content of the properties using the read( properties: string ): void
method, for example:
const reader = require('properties-reader');
const request = require('request');
const properties = reader(`${__dirname}/some.properties`);
request('http://server.com/properties.ini', (err, res) => {
if (res) {
properties.read( res ); // assumes res is an ini file format, appends it into the reader
}
});