1.11.0 • Published 3 months ago

minecraft-server-properties-parser v1.11.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 months ago

minecraft-server-properties-parser

An API for parsing, stringifying & write the Minecraft server.properties file format

Installation

# npm
npm install minecraft-server-properties-parser

# yarn
yarn add minecraft-server-properties-parser

Usage

parsePropertiesStringToJson

NameReturnDescription
parsePropertiesStringToJsonJsonparsePropertiesStringToJson allow you to get the json conversion of a .properties file

args

ParameterTypeDescriptionRequired
propertiesContentstringcontent to parseTrue
propertiesPathstringpth of the file to chick if it's a .propertiesTrue

example

const content = `
    broadcast-rcon-to-ops=true,
    view-distance=10,
    max-build-height=256
`

import {parsePropertiesStringToJson} from "minecraft-server-properties-parser"
const parsePropertiesStringToJson = await parsePropertiesStringToJson(content, path)

propertiesFileHasKey

NameReturnDescription
propertiesFileHasKeyBooleanCheck if a properties file contain a specific key

args

ParameterTypeDescriptionRequired
propertiesFilePropertiesFileproperties file object to checkTrue
keystringkey to check if existTrue

example

import {propertiesFileHasKey} from "minecraft-server-properties-parser"
propertiesFileHasKey(propertiesFile, key)

writePropertiesFile

NameReturnDescription
writePropertiesFilePromiseWrite a properties file object as a .properties file

args

ParameterTypeDescriptionRequired
propertiesPropertiesFileproperties file object to checkTrue
pathstringpath where the file will be writtenTrue

example

import {writePropertiesFile} from "minecraft-server-properties-parser"
// it can be the same path from the actual edited file and will replace the old with the new changes
await writePropertiesFile(properties, path)
1.9.0

3 months ago

1.8.0

3 months ago

1.11.0

3 months ago

1.7.0

9 months ago

1.6.0

9 months ago

1.5.0

9 months ago

1.4.0

9 months ago

1.3.0

9 months ago

1.2.0

9 months ago

1.1.1

9 months ago

1.1.0

9 months ago