https://github.com/thomascogez/mcpropertiesparser
A simple, lightweight and type safe .properties file parser that allow to read/edit .properties minecraft 🏹 server files
https://github.com/thomascogez/mcpropertiesparser
mc minecraft properties server
Last synced: 7 months ago
JSON representation
A simple, lightweight and type safe .properties file parser that allow to read/edit .properties minecraft 🏹 server files
- Host: GitHub
- URL: https://github.com/thomascogez/mcpropertiesparser
- Owner: Thomascogez
- Created: 2020-10-11T11:52:35.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-27T20:33:12.000Z (about 3 years ago)
- Last Synced: 2025-02-04T05:16:40.228Z (over 1 year ago)
- Topics: mc, minecraft, properties, server
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/mcpropertiesparser
- Size: 223 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
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 | 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 | 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)
```