GridCraft.Util

Generic utility functions

API Overview #

API Documentation #

Deprecateds #

getApplicationIconDataUri #

SignatureGridCraft.Util.getApplicationIconDataUri(string, hs.application) -> string or nil
TypeDeprecated
Description

Get an application icon as a data: URI

Parameters
  • appName - The name of the application (used for logging)
  • application - The hs.application object of the application
Returns
  • A string containing a data URI with base64-encoded PNG data of the application icon, or nil if the icon cannot be retrieved
Notes
  • We don’t use this internally so it will be removed in the future.

Functions #

fileContents #

SignatureGridCraft.Util.fileContents(string) -> string or nil
TypeFunction
Description

Get the contents of a file at a given path

Parameters
  • fullPath - The full path to the file

base64 #

SignatureGridCraft.Util.base64(string) -> string
TypeFunction
Description

Encode a string in base64 format

Parameters
  • data - The string to encode

findApplicationPath #

SignatureGridCraft.Util.findApplicationPath(string) -> string or nil
TypeFunction
Description

Find an application path by its name

Parameters
  • appName - The name of the application to find

getBasename #

SignatureGridCraft.Util.getBasename(string) -> string
TypeFunction
Description

Get the last component of a file path, or “/” if the path is the root directory

Parameters
  • path - The file path to get the basename from