Skip to content

UI5 FS

The UI5 FS provides a UI5-specific file system abstraction.

API Reference

Overview

The virtual file system "UI5 FS" offers an abstraction layer from the physical file system. Among other features, it can combine a set of scattered file locations into a well-defined virtual structure.

Resource

A Resource basically represents a file. Besides providing access to the file content, it also carries metadata like the virtual path of the Resource.

Resources are typically created and stored in Adapters. Once read from a physical file system, they are typically kept in memory for further processing in other modules.

This ensures a high build performance, as physical read and write access for a high number of resources is kept to a minimum.

Adapters

Adapters abstract access to different resource locations.

The Memory Adapter represents a virtual file system which maintains respective Resources inside a virtual data structure.

The File System Adapter, on the other hand, has direct access to the physical file system. It maps a "virtual base path" to a given physical path.

Both adapters provide APIs to retrieve and persist Resources, namely

  • to retrieve a single resource by its virtual path use byPath(),
  • to retrieve many resources based on patterns use byGlob(),
  • to persist a single resource use write().

Reader Collections

Reader collections allow grouped access to multiple adapters, which might even be nested in other reader collections.

They implement the same API for retrieving resources as adapters (byPath and byGlob). Multiple flavors exist:

  • ReaderCollection: The most basic collection. Allows parallel read access to multiple readers (i.e. adapters or collections)
  • ReaderCollectionPrioritized: Contains a list of readers which are searched in-order. This allows one reader to "overlay" resources of another
  • DuplexCollection: Contains a single reader and a single "writer". It therefore also implements the Adapter API for persisting resources (write()). When retrieving resources, the writer is prioritized over the reader
  • WriterCollection: Contains a set of writers and a mapping for each of them. When writing a resource, the writer is chosen based on the resource's virtual path.