Contains MountFS class which is a virtual filesystem which can have other filesystems linked as branched directories.
For example, lets say we have two filesystems containing config files and resources respectively:
[config_fs] |-- config.cfg `-- defaults.cfg [resources_fs] |-- images | |-- logo.jpg | `-- photo.jpg `-- data.dat
We can combine these filesystems in to a single filesystem with the following code:
from fs.mountfs import MountFS combined_fs = MountFS combined_fs.mountdir('config', config_fs) combined_fs.mountdir('resources', resources_fs)
This will create a single filesystem where paths under config map to config_fs, and paths under resources map to resources_fs:
[combined_fs] |-- config | |-- config.cfg | `-- defaults.cfg `-- resources |-- images | |-- logo.jpg | `-- photo.jpg `-- data.dat
Now both filesystems can be accessed with the same path structure:
print combined_fs.getcontents('/config/defaults.cfg') read_jpg(combined_fs.open('/resources/images/logo.jpg')
Mounts a host FS object on a given path.
Parameters: |
|
---|
Mounts a single file path.
Parameters: |
|
---|
Unmounts a path.
Parameters: |
|
---|
fs.memoryfs
fs.multifs