MemoryFS

A MemoryFS is a filesystem that exists entirely in memory.

Since a memory filesystems isn't backed by any persistant storage, it is very fast. The downside is, of course, that when you a close a memory filesystem, the files and folders disappear.

Here's how you can create a memory filesystem:

from fs.memoryfs import MemoryFS
mem_fs = MemoryFS()

Or by using an FS url:

from fs import open_fs
mem_fs = open_fs('mem://')

A memory-based filesystem is surprisingly useful, with use-cases similar to TempFS ; including caching and unit tests.

See MemoryFS docs for more information.

Author
Will McGugan
Published
Aug 21, 2017
Revision
1