# cp.plist

Reads & Writes plist data.


# Submodules


# API Overview

Functions - API calls offered directly by the extension

  • base64ToTable
  • binaryFileToTable
  • binaryFileToXML
  • binaryToTable
  • fileToTable
  • isBinaryPlist
  • isBinaryPlistFile
  • isPlist
  • isPlistFile
  • isXMLPlist
  • isXMLPlistFile
  • xmlFileToTable
  • xmlToTable

# API Documentation

# Functions

# base64ToTable

Signature cp.plist.base64ToTable(base64Data) -> table | nil, string
Type Function
Description Converts base64 encoded Property List string into a Table.
Parameters
  • base64Data - Binary data encoded in base64 as a string
Returns
  • A table of the plist data
  • A error message as string if an error occurs
Notes None
Examples None
Source src/extensions/cp/plist/init.lua line 19

# binaryFileToTable

Signature cp.plist.binaryFileToTable(plistFileName) -> table | nil, string
Type Function
Description Converts the data from a Binary File into a LUA Table.
Parameters
  • plistFileName - Path & Filename of the Binary File
Returns
  • data - A table of plist data, or nil if there was a problem.
  • err - The error message, or nil if there were no problems.
Notes None
Examples None
Source src/extensions/cp/plist/init.lua line 107

# binaryFileToXML

Signature cp.plist.binaryFileToXML(plistFileName) -> string | nil, string
Type Function
Description Converts the data from a Binary plist File into XML as a string.
Parameters
  • plistFileName - Path & Filename of the Binary File
Returns
  • data - A string of XML data
  • err - The error message, or nil if there were no problems.
Notes None
Examples None
Source src/extensions/cp/plist/init.lua line 140

# binaryToTable

Signature cp.plist.binaryToTable(binaryData) -> table | nil, string
Type Function
Description Converts Binary Data into a LUA Table.
Parameters
  • binaryData - Binary data
Returns
  • data - A string of XML data
  • err - The error message, or nil if there were no problems.
Notes None
Examples None
Source src/extensions/cp/plist/init.lua line 74

# fileToTable

Signature cp.plist.fileToTable(plistFileName) -> table | nil, string
Type Function
Description Converts plist data from a binary or XML file into a LUA Table.
Parameters
  • plistFileName - Path & Filename of the XML File
Returns
  • data - A table of plist data, or nil if there was a problem.
  • err - The error message, or nil if there were no problems.
Notes
  • It will check the file prior to loading to determine which type it is.
  • If you know which type of file you're dealing with in advance, you can use cp.plist.xmlFileToTable() or hs.plist.binaryFileToTable() instead.
Examples None
Source src/extensions/cp/plist/init.lua line 210

# isBinaryPlist

Signature cp.plist.isBinaryPlist(data) -> boolean
Type Function
Description Checks if the provided data is a binary plist.
Parameters
  • data - The data to check
Returns
  • true if it is a binary plist, false otherwise.
Notes None
Examples None
Source src/extensions/cp/plist/init.lua line 260

# isBinaryPlistFile

Signature cp.plist.isBinaryPlistFile(plistList) -> boolean
Type Function
Description Returns true if plistList is a binary plist file otherwise false.
Parameters
  • plistList - Path to the file
Returns
  • Boolean
Notes None
Examples None
Source src/extensions/cp/plist/init.lua line 315

# isPlist

Signature cp.plist.isPlist(data) -> boolean
Type Function
Description Checks if the data is either a binary or XML plist data string.
Parameters
  • data - The data to check
Returns
  • true if the data is a plist, false otherwise.
Notes None
Examples None
Source src/extensions/cp/plist/init.lua line 243

# isPlistFile

Signature cp.plist.isPlistFile(plistFileName) -> boolean
Type Function
Description Checks if the provided file is a binary or XML plist file.
Parameters
  • plistFileName - Path & Filename of the XML File
Returns
  • true if it is a binary or XML plist file, false otherwise.
Notes None
Examples None
Source src/extensions/cp/plist/init.lua line 289

# isXMLPlist

Signature cp.plist.isXMLPlist(data) -> boolean
Type Function
Description Checks if the provided data is an XML plist.
Parameters
  • data - The data to check
Returns
  • true if it is an XML plist, false otherwise.
Notes
  • This will only check if it is an XML file, it does not check the actual format is correct.
Examples None
Source src/extensions/cp/plist/init.lua line 273

# isXMLPlistFile

Signature cp.plist.isXMLPlistFile(plistList) -> boolean
Type Function
Description Returns true if plistList is (probably) an XML plist file otherwise false.
Parameters
  • plistList - Path to the file
Returns
  • Boolean
Notes None
Examples None
Source src/extensions/cp/plist/init.lua line 342

# xmlFileToTable

Signature cp.plist.xmlFileToTable(plistFileName) -> table | nil, string
Type Function
Description Converts XML data from a file into a LUA Table.
Parameters
  • plistFileName - Path & Filename of the XML File
Returns
  • data - A table of plist data, or nil if there was a problem.
  • err - The error message, or nil if there were no problems.
Notes None
Examples None
Source src/extensions/cp/plist/init.lua line 180

# xmlToTable

Signature cp.plist.xmlToTable(plistXml) -> table | nil, string
Type Function
Description Converts an XML plist string into a LUA Table.
Parameters
  • plistXml - The XML string
Returns
  • data - A table of plist data, or nil if there was a problem.
  • err - The error message, or nil if there were no problems.
Notes None
Examples None
Source src/extensions/cp/plist/init.lua line 165