2.0.4 • Published 3 years ago

@scriptserver/json v2.0.4

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
3 years ago

@scriptserver/json

npm.io

FYI: This package is an addon for ScriptServer and requires ScriptServer to be set up, please see here for more information.

useJson(server: ScriptServer | JavaServer | RconConnection)

import { ScriptServer, RconConnection, JavaServer } from '@scriptserver/core';
import { useJson } from '@scriptserver/json';

const scriptServer = new ScriptServer();
useJson(scriptServer.rconConnection);
// Or
const rconConnection = new RconConnection({
  json: {
    path: __dirname + '/json',
  },
});
useJson(rconConnection);

// Or

const javaServer = new JavaServer({
  json: {
    path: __dirname + '/json',
  },
});
useJson(javaServer);

Class: ScriptServer | JavaServer | RconConnection

This module adds the json methods to all of the three servers, depending on what is passed in to the useJson() method

server.json.get: (path: string, key?: string) => Promise<T>

server.json.set: (path: string, key: string, value: T) => Promise<T>

Interface: Config

These configuration options are here to override as needed for flavors, if you are having trouble getting the utils to work in your given flavor of server, try overriding these.

  • config: Config
    • json
      • path: string