Javascript ConfigFile

From Yate Documentation
Revision as of 13:55, 1 April 2014 by Paulc (Talk | contribs)

Jump to: navigation, search

Configuration File handling object.

Constructor

new ConfigFile(); new ConfigFile(path); new ConfigFile(path,warn);

Where:

  • path - Relative or absolute path to the Configuration file like "/path/to/file.conf"
  • warn - True to warn if the file does not exist

Methods

  • name()

Returns the path of the Configuration file.

  • name(path)

Sets a new file path

  • load(warn)

Loads the file content, optionally warns if it doesn't exist.

Returns true on success or false if the file does not exist.

  • save()

Saves the file overwriting any existing content.

Returns true on success or false if the file could not be written.

  • count()

Returns the number of sections in the file.

  • sections()

Returns an associative Array containing ConfigSection objects representing each file section.

  • getSection(name)

Returns a ConfigSection object for the section name.

Returns null if the section does not exist.

  • getSection(name,create)

Returns a ConfigSection object for the section name, creates it if create is true.

Returns null if the section could not be created.

  • getValue(section,key)

Retrieves the value of key in section. Returns undefined if the key or section does not exist.

  • getValue(section,key,defValue)

Retrieves the value of key in section. Returns defValue if the key or section does not exist.

  • setValue(section,key,value)

Sets the value for key in specified file section.

  • clearKey(section,key)

Deletes the key from specified file section.

  • keys(section)

Returns a numbered (non-associative) Array containing all the key names in section.

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers