DictFs¶
Description:
- DictFS is a nested dictionary-based, in-memory filesystem and acts more like a real LocalFileSystem.
Resources:
Example 1¶
Create a dir and a text file and put text in the file and check to see what's in it
In [ ]:
Copied!
from morefs.dict import DictFS
dfs = DictFS()
# Create a dir and define files to be created
fp = "/tmp/ganymede_demo"
dfs.makedirs(fp)
test_fp1 = f"{fp}/test1.txt"
dfs.touch(test_fp1)
dfs.pipe_file(test_fp1, b"contents")
dfs.info(test_fp1)
from morefs.dict import DictFS
dfs = DictFS()
# Create a dir and define files to be created
fp = "/tmp/ganymede_demo"
dfs.makedirs(fp)
test_fp1 = f"{fp}/test1.txt"
dfs.touch(test_fp1)
dfs.pipe_file(test_fp1, b"contents")
dfs.info(test_fp1)