# mcpropertiesparser

> A simple, lightweight and type safe .properties file parser that allow to read/edit .properties minecraft server file

Latest version **1.1.0** (published 2023-03-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install mcpropertiesparser
pnpm add mcpropertiesparser
yarn add mcpropertiesparser
bun add mcpropertiesparser
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2023-03-27 |
| First published | 2020-10-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Thomascogez |
| Maintainers | thomas.ca |
| Keywords | minecraft, mc, server, properties |

## Links

- npm: https://www.npmjs.com/package/mcpropertiesparser
- Homepage: https://github.com/Thomascogez/mcPropertiesParser
- npm.io page: https://npm.io/package/mcpropertiesparser

## Recent versions

- 1.1.0 (latest) — 2023-03-27
- 1.0.3 — 2020-10-20
- 1.0.2 — 2020-10-19
- 1.0.1 — 2020-10-11
- 1.0.0 — 2020-10-11

## README

# mcPropertiesParser

> mcPropertiesParser is a lightweight and typesafe set of utilies to parse and modify .properties file of mc servers



## Install

```shell
npm install mcpropertiesparser
# or
yarn add mcpropertiesparser
```



## Docs

### parsePropertiesFileToJson

| Name                      | Return                  | Description                                                  |
| ------------------------- | ----------------------- | ------------------------------------------------------------ |
| parsePropertiesFileToJson | Promise<PropertiesFile> | parsePropertiesFileToJson allow you to get the json conversion of a .properties file |

#### args

| Parameter      | Type   | Description                           | Required |
| -------------- | ------ | ------------------------------------- | -------- |
| propertiesPath | string | path of the .properties file to parse | True     |

#### example

```typescript
import {parsedPropertiesFile} from "mcpropertiesparser"
const parsedPropertiesFile = await parsePropertiesFileToJson(path)

```



### propertiesFileHasKey

| Name                 | Return  | Description                                       |
| -------------------- | ------- | ------------------------------------------------- |
| propertiesFileHasKey | Boolean | Check if a properties file contain a specific key |

#### args

| Parameter      | Type           | Description                     | Required |
| -------------- | -------------- | ------------------------------- | -------- |
| propertiesFile | PropertiesFile | properties file object to check | True     |
| key            | string         | key to check if exist           | True     |

#### example

```typescript
import {propertiesFileHasKey} from "mcpropertiesparser"
propertiesFileHasKey(propertiesFile, key)

```



### writePropertiesFile

| Name                | Return        | Description                                          |
| ------------------- | ------------- | ---------------------------------------------------- |
| writePropertiesFile | Promise<void> | Write a properties file object as a .properties file |

#### args

| Parameter    | Type           | Description                         | Required |
| ------------ | -------------- | ----------------------------------- | -------- |
| *properties* | PropertiesFile | properties file object to check     | True     |
| path         | string         | path where the file will be written | True     |

#### example

```typescript
import {writePropertiesFile} from "mcpropertiesparser"
// it can be the same path from the actual edited file and will replace the old with the new changes
await writePropertiesFile(properties, path)

```

---
_Source: https://npm.io/package/mcpropertiesparser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
