properties-to-yml

Converts a .properties string/file to .yml string/file

Usage no npm install needed!

<script type="module">
  import propertiesToYml from 'https://cdn.skypack.dev/properties-to-yml';
</script>

README

Quality Gate Status Maintainability Rating Reliability Rating Security Rating Bugs Vulnerabilities Coverage Pipeline

PropertiesToYml

Converts strings/files from the properties format to strings/files in the yaml format with a nice Fluent interface.

Quick start

  1. Add PropertiesToYml as a dependency of your project. It's as simple as:
npm i properties-to-yml
  1. Import the library
import { PropertiesToYml } from 'properties-to-yml';
  1. 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