OpenWGA 7.9 - TMLScript reference

WGA
Object:

WGA.File(filename | File-Object)

Description

Utility object to read and write file contents.

If called with filename (String) as argument the object is initialised with a file (or folder) with that name relative to the OpenWGA config folder. When called with a java.io.File object that file object will be used.

This object is available since version 7.7.2

Retrieval WGA.File(filename | File)
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
Properties and methods
Name Purpose
append(text, [encoding]) Appends the content to the referenced file.
asString([encoding]) Returns the content of the referenced file as String
asXMLDocument([encoding]) Returns the content of the referenced file as DOM4J XML document.
copy(InputStream)
copy(WGDocument | TMLContext, attachmentname)
Copies filedata from an imput steam or content attachment to the file.
createZipStream() Creates a ZipStream object to generate zip files.
file Gets (or sets) the wrapped java.io.File object
listFiles([filter]) List all files in the referenced folder optional filtered by a filter function.
write(text | XMLDocument, [encoding]) Writes the given content to the file.