Skip to content

Commit 5f0254a

Browse files
authored
docs: fs.readFile example
1 parent 2c35c7e commit 5f0254a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ console.log(props)
2727
// { lines: [ 'key1=value1', 'key2 = value2', 'key3: value3' ] }
2828
```
2929

30+
To read a file from a disk, use standard node `fs` module:
31+
32+
```ts
33+
import fs from 'node:fs'
34+
import * as properties from 'js-java-properties'
35+
36+
const props = properties.parse(fs.readFileSync('file.properties', 'utf-8'))
37+
```
38+
3039
### Stringify
3140

3241
Formats property lines into string.

0 commit comments

Comments
 (0)