-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
46 lines (27 loc) · 691 Bytes
/
main.py
File metadata and controls
46 lines (27 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from filesystem import SimpleFS, Storage
storage = Storage(100, "data")
# storage.create()
fs = SimpleFS(storage=storage)
print(fs.blocks[0])
print(fs.block_size)
"""
A file is constitutes of bytes
"""
# file_content = "hello world"
# fs.create("whatever", file_content)
# # # print(fs.root_dir)
# file_obj = fs.open("whatever")
# print(file_obj)
# content = fs.read(file_obj)
# print(content)
# fs.write(file_obj, "Happy new year!")
# for block in fs.blocks:
# print(block.start)
# content = fs.read(file_obj)
# print(content)
# fs.append(file_obj, " 2024")
# content = fs.read(file_obj)
# print(content)
# file_obj.get_metadata()
# fs.info()
fs.delete("whatever")