SerenityJS
    Preparing search index...
    Index

    Constructors

    Properties

    dataPath: string

    The path to the plugin's data directory.

    Methods

    • Checks if a file or directory exists in the plugin's data directory.

      Parameters

      • path: string

        The relative path to the file or directory to check.

      Returns boolean

      True if the file or directory exists, otherwise false.

    • Creates a directory in the plugin's data directory.

      Parameters

      • path: string

        The relative path to the directory to create.

      Returns undefined | string

      The path of the created directory if successful, otherwise undefined.

    • Reads the contents of a directory in the plugin's data directory.

      Parameters

      • path: string

        The relative path to the directory to read.

      Returns null | string[]

      An array of file and directory names in the specified directory, or null if the directory does not exist or is invalid.

    • Reads a file from the plugin's data directory.

      Parameters

      • path: string

        The relative path to the file to read.

      Returns null | Buffer<ArrayBufferLike>

      The file data if it exists and is valid, otherwise null.

    • Reads a file from the plugin's data directory.

      Parameters

      • path: string

        The relative path to the file to read.

      • encoding: BufferEncoding

        Optional encoding. If provided, returns a string; otherwise, returns a Buffer.

      Returns null | string

      The file data if it exists and is valid, otherwise null.

    • Removes a file from the plugin's data directory.

      Parameters

      • path: string

        The relative path to the file to remove.

      Returns void

    • Removes a directory from the plugin's data directory.

      Parameters

      • path: string

        The relative path to the directory to remove.

      • options: { force: boolean; recursive: boolean } = ...

      Returns void

    • Writes data to a file in the plugin's data directory.

      Parameters

      • path: string

        The relative path to the file to write.

      • data: string | Buffer<ArrayBufferLike>

        The data to write to the file.

      Returns void