getFile Method

Extract a local copy of a file resource from this WorkspaceDb, if present.

getFile(rscName: string, targetFileName?: string): undefined | string

@returns the full path to a file on the local filesystem.

@note The file is copied from the file into the local filesystem so it may be accessed directly. This happens only as necessary, if the local file doesn't exist, or if it is out-of-date because it was updated in the file. For this reason, you should not save the local file name, and instead call this method every time you access it, so its content is always holds the correct version.

@note The filename will be a hash value, not the resource name.

@note Workspace resource files are set readonly as they are copied from the file. To edit them, you must first copy them to another location.

Parameter Type Description
rscName string The name of the file resource in the WorkspaceDb
targetFileName string optional name for extracted file. Some applications require files in specific locations or filenames. If
you know the full path to use for the extracted file, you can supply it. Generally, it is best to not supply the filename and
keep the extracted files in the filesDir.

Returns - undefined | string

the full path to a file on the local filesystem.

Defined in

Last Updated: 16 April, 2024