Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Environment

The environment in which an nrelay project resides.

This class is the API between the various files that nrelay uses (such as the packets and acc config etc) and nrelay itself. Its goal is to provide a good abstraction for interacting with files and folders.

Hierarchy

  • Environment

Index

Constructors

constructor

Properties

root

root: string

The root path of this environment. Generally, this will be the folder which contains the nrelay project.

Methods

mkTempDir

  • mkTempDir(): void

pathTo

  • pathTo(...relativePath: string[]): string
  • Creates a full path from the relative path provided.

    Parameters

    • Rest ...relativePath: string[]

      The relative path to get.

    Returns string

readJSON

  • readJSON<T>(...relativePath: string[]): T
  • Gets th

    Type parameters

    • T

    Parameters

    • Rest ...relativePath: string[]

      The relative path to the file.

    Returns T

rmTempDir

  • rmTempDir(): void

updateJSON

  • updateJSON<T>(json: T, ...relativePath: string[]): void
  • Updates the object stored at the given path. This essentially just calls readJSON, then updates the object, then calls writeJSON.

    Type parameters

    • T

    Parameters

    • json: T

      The object to use when updating.

    • Rest ...relativePath: string[]

      The path of the file to update.

    Returns void

writeJSON

  • writeJSON<T>(json: T, ...relativePath: string[]): void
  • Writes the JSON object into the specified file.

    Type parameters

    • T

    Parameters

    • json: T

      The object to write.

    • Rest ...relativePath: string[]

      The path of to the file to write to.

    Returns void

Generated using TypeDoc