properties-to-yml
v1.0.2
Published
Converts a .properties string/file to .yml string/file
Downloads
9
Readme
PropertiesToYml
Converts strings/files from the properties
format to strings/files in the yaml
format with a nice Fluent interface.
Quick start
- Add PropertiesToYml as a dependency of your project. It's as simple as:
npm i properties-to-yml
- Import the library
import { PropertiesToYml } from 'properties-to-yml';
- Start converting
Examples
String to string
const output = new PropertiesToYml()
.fromString('server.port = 8080')
.convert()
.toString();
File to string
const output = new PropertiesToYml()
.fromFile('/path/to/file.properties')
.convert()
.toString();
File to file
new PropertiesToYml()
.fromFile('/path/to/file.properties')
.convert()
.toFile('/path/to/file.yml');
String to file
new PropertiesToYml()
.fromString('server.port = 8080')
.convert()
.toFile('/path/to/file.yml');
White spaces
You can customize how many spaces must be used in the outputted yaml.
To do so, just call .spaces(N)
before calling the convert()
method.
Example:
new PropertiesToYml()
.spaces(4)
.fromFile('/path/to/file.properties')
.convert()
.toFile('/path/to/file.yml');
Develop
Write code and run tests against it with npm test