Skip to content

niemasd/NiemaFS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NiemaFS

Niema's Python library for reading data from various file system standards

Installation

NiemaFS can be installed using pip:

sudo pip install niemafs

If you are using a machine on which you lack administrative powers, NiemaFS can be installed locally using pip:

pip install --user niemafs

Usage

The workflow to use each of the NiemaFS classes is as follows:

  1. Instantiate the appropriate NiemaFS class by providing a path path and a file-like object file_obj
  2. Iterate over the contents of the NiemaFS object using a for-loop, each iteration of which will yield a tuple as follows:
    1. The Path of the file/folder within the file system
    2. The modification timestamp of the file/folder as a datetime, or None if the file system does not store timestamps
    3. The contents of the file as bytes, or None for directories
for curr_path, curr_timestamp, curr_data in fs:
    if curr_data is None:
        print('DIR', curr_path, curr_timestamp)
    else:
        print('FILE', curr_path, curr_timestamp, len(curr_data))

See the documentation as well as the example scripts for more information. This repository also contains example files to test the NiemaFS classes.

DirFS — Directories

from niemafs import DirFS
fs = DirFS(path=target_path)

GcmFS — Nintendo GameCube Mini-DVD

from niemafs import GcmFS
with open(target_path, 'rb') as target_file:
    fs = GcmFS(path=target_path, file_obj=target_file)

GcRarcFS — Nintendo GameCube RARC Archive

from niemafs import GcRarcFS
with open(target_path, 'rb') as target_file:
    fs = GcRarcFS(path=target_path, file_obj=target_file)

IsoFS — ISO 9660 Disc Image

from niemafs import IsoFS
with open(target_path, 'rb') as target_file:
    fs = IsoFS(path=target_path, file_obj=target_file)

TarFS — TAR Archive

from niemafs import TarFS
with open(target_path, 'rb') as target_file:
    fs = TarFS(path=target_path, file_obj=target_file)

TgcFS — Nintendo GameCube TGC Image

from niemafs import TgcFS
with open(target_path, 'rb') as target_file:
    fs = TgcFS(path=target_path, file_obj=target_file)

WiiFS — Nintendo Wii DVD

Note that, due to the need to decrypt the file system, this is extremely memory-intensive (each partition is loaded into memory to process in parallel for speed).

from niemafs import WiiFS
with open(target_path, 'rb') as target_file:
    fs = WiiFS(path=target_path, file_obj=target_file)

ZipFS — ZIP Archive

from niemafs import ZipFS
with open(target_path, 'rb') as target_file:
    fs = ZipFS(path=target_path, file_obj=target_file)

Acknowledgements

The following resources were extremely helpful in the development of NiemaFS:

About

Niema's Python library for reading data from various file system standards

Resources

License

Stars

Watchers

Forks

Contributors