FileMap-class: The FileMap class

FileMap-classR Documentation

The FileMap class

Description

A reference class to represent a file map and handle persisting it to file. A file map is a directory-specific dictionary keyed by file names (without suffixes), whose values point to the actual locations of the associated files. This saves duplicating large files such as images, in a way similar to symbolic linking, but without requiring special file system support, and with only one link per file set rather than one per file. The map is serialised in YAML format to a file called map.yaml in the relevant directory. Reading from this file happens on object creation and when the read method is called; writing is only by an explicit call to the write method.

Fields

directory

A character string representing the directory being mapped.

map

A list representation of the map in memory.

Methods

dropElements(keys)

Remove elements with the specified keys from the in-memory map

getElements(keys)

Return the values associated with the specified keys

getFile()

Return the path to the map file, which may not yet exist

getMap(sorted = FALSE)

Return the in-memory map, optionally sorted by key

initialize(path = "", ...)

Create a FileMap object for the specified paths

read()

Read the map file into memory

setElements(keys, values)

Replace the specified keys with new values, which should be strings

write()

Write the in-memory map to file, or delete the file if it is empty


tractor.base documentation built on Nov. 5, 2025, 6:18 p.m.