Class FrontendFs

This service allows the application to easily work with the filesystem. The idea behind centralizing this functionalities into a service is that is pretty common to have bundling tools to generate the frontend, and on that process files can have different paths or not even be generated all. The service can be extended/overwritten to accommodate any requirements and avoid having to update or add ifs to every fs call the application does. Another 'feature' of this service is that all the paths are relative to the directory where the app executable is located, so you don't have to remember the relative path from the place you are accessing a file to the place where it's located.

Constructors

Properties

Methods

Constructors

Properties

_pathUtils: PathUtils

The service that generates the relative paths.

Methods

  • Utility method to get the path of a file relative to the application executable.

    Parameters

    • filepath: string

      The path to the file.

    Returns string

  • Reads a file from the file system.

    Parameters

    • filepath: string

      The path to the file.

    • encoding: BufferEncoding = 'utf-8'

      The text encoding in which the file should be read.

    Returns Promise<string>

  • Writes a file on the file system.

    Parameters

    • filepath: string

      The path to the file.

    • content: string | Stream | ArrayBufferView | Iterable<(string | ArrayBufferView)> | AsyncIterable<(string | ArrayBufferView)>

      The contents of the file.

    Returns Promise<void>

Generated using TypeDoc