A collection of WrapFS objects that modify the behavior of another filesystem.

Here’s an example that opens a filesystem then makes it read only:

from fs import open_fs
from fs.wrap import read_only

projects_fs = open_fs('~/projects')
read_only_projects_fs = read_only(projects_fs)

# Will raise ResourceReadOnly exception
class fs.wrap.WrapCachedDir(wrap_fs)

Caches filesystem directory information.

This filesystem caches directory information retrieved from a scandir call. This may speed up code that calls isdir, isfile, or gettype too frequently.


Using this wrap will prevent changes to directory information being visible to the filesystem object. Consequently it is best used only in a fairly limited scope where you don’t expected anything on the filesystem to change.

class fs.wrap.WrapReadOnly(wrap_fs)

Makes a Filesystem read-only. Any call that would would write data or modify the filesystem in any way will raise a ResourceReadOnly exception.


Make a filesystem that caches directory information.

Parameters:fs – A FS object.
Returns:A filesystem that caches results of scandir, isdir and other methods which read directory information.

Make a read-only filesystem.

Parameters:fs – A FS object.
Returns:A read only version of fs.