Skip to content

Overview of File/HTTP APIs

The File/HTTP APIs provide various functions to handle file operations and HTTP requests within the Ghost API. These APIs cover a wide range of operations, from reading and writing configuration files to making HTTP POST requests.

Key Points

  • LoadGhostFile: Loads a local ghost file.
  • LoadRemoteGhostFile: Loads a ghost file from a remote server.
  • LoadRemotePackage: Loads a package from a remote server.
  • ReadConfig: Reads configuration settings from a file.
  • WriteConfig: Writes configuration settings to a file.
  • HTTPPost: Sends an HTTP POST request to a specified URL.

Covered APIs

LoadGhostFile

Loads a local ghost file from the specified path within the base directory where the Ghost executable is located.

LoadRemoteGhostFile

Loads a ghost file from a remote server using the specified URL, data, and headers.

LoadRemotePackage

Loads a package from a remote server using the specified URL, data, and headers. A ghost package file is a collection of Lua files converted into a single ghost package file.

ReadConfig

Reads configuration settings from a file located in the configs directory within the scripts folder. The configuration files are heavily encrypted to ensure data safety.

WriteConfig

Writes configuration settings to a file in the configs directory within the scripts folder. The configuration files are heavily encrypted to ensure data safety.

HTTPPost

Sends an HTTP POST request to a specified URL with given data and headers. Useful for interacting with web services, APIs, and remote servers.

Conclusion

The File/HTTP APIs provide essential functions that facilitate various file operations and HTTP requests, making it easier for developers to interact with and manipulate data within the Ghost API. By leveraging these APIs, developers can create more dynamic and responsive applications.