单文件内部多用途虚拟文件系统
SVFS的Python项目详细描述
概述
svfs允许在真实文件系统上的文件内部创建虚拟文件系统。 它可用于在单个文件(具有目录结构)中存储多个文件。 与存档不同,svfs允许就地修改文件。 svfs文件使用类似于文件的接口,因此它们可以像普通python文件对象一样使用(几乎可以)。 最后,它是用纯python实现的,不使用任何第三方模块,因此应该是非常可移植的。 测试显示,写入速度约为10-12 MB/s,读取速度约为26-28 MB/s。
示例
以下代码创建SVF,打开其中的文件,写入字符串并将其读回:
from SVFS import SVFS #Import SVFS class s = SVFS() #Create instance of SVFS class s.CreateSVFS('test.svfs','testvolume',100,100,100) #Create SVFS with 100 inodes and 100 blocks of 100 bytes. s.OpenSVFS('test.svfs') #Open created SVFS with s.open('testfile','w') as file: #Create and open new file for writing in SVFS. file.write('write test') #Write string into file t = s.open('testfile','r') #Open same file for reading print t.read() #Read entire file and print data t.close() #Close file s.CloseSVFS() #Close SVFS
代码输出:
write test
这意味着它工作正常。
更改日志
2.0.0版:
初始版本
联系人
此模块由andrew stolberg<;andrewstolberg@gmail.com>;维护。如果你有任何问题或想帮忙,请发电子邮件给我。