expliot.core.bom
¶
BOM functionality
Subpackages¶
Package Contents¶
Classes¶
Enumerate a directory and get info on all the |
- class expliot.core.bom.DirEnumerator¶
Enumerate a directory and get info on all the files and dirs recursively.
- enumerate(directory, callback)¶
Directory enumerator 1. Enumerate the specified root dir recursively 2. Get metadata of each file 3. Call the callback method for each file and pass the metadata
- Args:
directory (str): The directory to enumerate callback (method): The callback method to be called for each file.
- The format is callback(rootdir, currentdir, filedata)
rootdir(str): Root directory path being enumerated
currentdir(str): The current directory i.e. parent of the file
- filedata (dict): File metadata
name = File name(str) abspath = Absolute path of the file (str) relpath = Relative path of the file (from the root directory) mode = File mode (str) size = File size in bytes symlink = Yes - True, No - False (bool) mime = Mime-Type (str), descr = Description from libmagic (str), sha1 = SHA1 Hash (str), sha256 = SHA256 Hash (str)
- Returns:
Nothing
- Raises:
ValueError - if the dir argument is not a valid directory i.e. doesn’t exist