Skip to main content

SVFS

(Quoting from the original project README):

SVFS allows to create virtual filesystem inside file on real filesystem. It can be used to store multiple files inside single file (with directory structure). Unlike archives, SVFS allows to modify files in-place. SVFS files use file-like interface, so they can be used (pretty much) like regular Python file objects. Finally, it’s implemented in pure python and doesn’t use any 3rd party modules, so it should be very portable. Tests show write speed to be around 10-12 MB/s and read speed to be around 26-28 MB/s.

Example

Following code creates SVFS, opens file in it, writes string and reads it back:

from svfs3 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

That code outputs:

write test

Which means it works correctly.

Updates to v3:

SVFS now distinguishes between strings/bytes and will transparently encode/decode:

# Open up a file in text mode. 
with s.open('text_file','w', encoding='utf8') as text_file: 
    # If no encoding is given, defaults to 'utf-8'
    text_file.write("""This is a\nmultiline\ntext file""") # Write string into file, encoded as utf-8

t_file = s.open('text_file','r') # Open same file for reading
t_file.readlines()

This code outputs:

['This is a\n', 'multiline\n', 'text file']

Binary files work similarly:

# Open up a file in binary mode. 
with s.open('binary_file','wb') as binary_file: 
    # Passing 'b' as part of the mode parameter sets binary mode
    binary_file.write(b'Some bytes')

b_file = s.open('binary_file', 'rb')
b_file.read()

Outputs:

b'Some bytes'

Encrypted Files

Another update is the availability of encrypted files. Example:

s = EncryptedSVFS('keytext-must-be-at-least-32-bytes-long') 
# Create instance of EncryptedSVFS class, pass in encryption key, must be at least 32 bytes long
s.CreateSVFS('encrypted.svfs','testvolume',100,100,100) 
# Create SVFS with 100 inodes and 100 blocks of 100 bytes.
s.OpenSVFS('encrypted.svfs') # Open created SVFS
with s.open('testfile','w') as file: # Create and open new file for writing in SVFS. Contents of this file will be encrypted
    file.write('write test') # Write string into file

Now the contents of "testfile" are encrypted on disk.

t = s.open('testfile','r') # Open same file for reading
print(t.read()) # Read entire file and print data, things are transparently decrypted
t.close() # Close file
s.CloseSVFS() # Close SVFSf

Metadata

Release files for svfs3 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for svfs3 3.0.0
File Size Uploaded
svfs3-3.0.0.tar.gz 58.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for svfs3 3.0.0
File Interpreter ABI Platform
svfs3-3.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 83.8 kB

Release files / svfs3-3.0.0.tar.gz

Download URL svfs3-3.0.0.tar.gz
Size 58.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f9dcf852cbdf6a681131e7b2de4df2bf783b3da40570505d9b5f79014b682c4d
BLAKE2b-256 checksum
How to use checksums
a897d517178f905abbac16f2e1e1e2999de87086c31a3aeb7e7437621d4f4108
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.0

Release files / svfs3-3.0.0-py3-none-any.whl

Download URL svfs3-3.0.0-py3-none-any.whl
Size 25.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cfd39e2522d07f8b965da08dab0b09bd5638110b367522bd91649ece228cdae1
BLAKE2b-256 checksum
How to use checksums
99e38b7571666738ec898138f95230527e8f3ddf841cf538fb50755bdbd6ae27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.6.0

Release history Release notifications | RSS feed

This release

3.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page