forked from mmcardle/sizefs
A mock file system for creating files of a particular size
License
jjw-itinnov/sizefs
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
SizeFS =========== A mock Filesystem that exists in memory only. Returns files of a size as specified by the filename For example, reading a file named 128Mb+1 will return a file of 128 Megabytes plus 1 byte, reading a file named 128Mb-1 will return a file of 128 Megabytes minus 1 byte :: sfs = SizeFS() print len(sfs.open('1B').read()) 1 print len(sfs.open('2B').read()) 2 print len(sfs.open('1KB').read()) 1024 print len(sfs.open('128KB').read()) 131072 The folder structure can also be used to determine the content of the files:: print sfs.open('zeros/5B').read(5) 00000 print sfs.open('ones/128KB').read(5) 11111 File content can also be random:: print len(sfs.open('random/128KB').read()) 131072 print len(sfs.open('random/128KB-1').read()) 131071 print len(sfs.open('random/128KB+1').read()) 131073 File content can be generated by restricted regex pattern by adding a directory:: sfs.add_regex_dir("regex1","a(bcd)*e{4}[a-z,0,3]*") print len(sfs.open('regex1/128KB').read()) 131072 print len(sfs.open('regex1/128KB-1').read()) 131071 print len(sfs.open('regex1/128KB+1').read()) 131073
About
A mock file system for creating files of a particular size
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Python 100.0%