Close

VFS Class

The VFS Class describes a COMP's virtual file system.


Members

ownerOP (Read Only):

Get the OP owner.

Methods

[name]VFSFile:

VFS Files may be easily accessed using the [] syntax.

  • name - Must be an exact VFS file name. Wildcards are not supported. If not found, an error will be raised.
p = op('base1').vfs['Banana.tif']

addByteArray(byteArray, name)VFSFile:

Add an embedded file from a bytearray to the component. Returns a VFSFile instance of the added file.

  • byteArray - A bytearray representing the contents of the file.
  • name - The name of the file on VFS.

addFile(filePath, overrideName=None)VFSFile:

Add an embedded file from disk to the component with an option to override the name. Returns a VFSFile instance of the added file.

  • filePath - The path of the file on disk to add.
  • overrideName (Keyword, Optional) - When specified, will override the name of the file in VFS.

export(folder, pattern='*', overwrite=False)list:

Exports any matching files to the folder on disk. If overwrite is True then any existing files on disks with the same name will be overwritten. Returns a list of paths on disk to the exported files.

  • folder - The folder on disk to export the files to.
  • pattern (Keyword, Optional) - The pattern to match names by.
  • overwrite (Keyword, Optional) - When True, will overwrite any files that share the same name.
# VFS contains one file with name 'A/B.tif'
COMP.vfs.export('C:/tmp') # returns ['C:/tmp/A/B.tif']

find(pattern='*')list:

Finds all files in VFS with names matching the pattern. Returns a list of VFSFile objects.

  • pattern (Keyword, Optional) - The pattern to match names by.