forked from ryanpcmcquen/propertiesToJSON
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
35 lines (34 loc) · 934 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const fs = require('fs');
const path = require('path');
const filePath = path.join(__dirname, 'sample.properties');
const propertiesToJSON = require('./index.js');
fs.readFile(filePath, { encoding: 'utf-8' }, (err, data) => {
if (!err) {
console.log(`
-----------------------------
'sample.properties' contents:
-----------------------------
`);
console.log(data);
const props = propertiesToJSON(data);
console.log(`
---------------------------------
Object of entire properties file:
---------------------------------
`);
console.log(props);
console.log(`
----------------------------------------
'website' key of object (props.website):
----------------------------------------
`);
console.log(props.website);
console.log(`
-----------------
That's all folks!
-----------------
`);
} else {
console.log(err);
}
});