magmap.io.subproc_io module#

File management using underlying system commands accessed through the Python subprocess module.

magmap.io.subproc_io.compress_file(path_in, path_out=None)[source]#

Compress a file or files by tar archving and compressing with.

Assumes that tar and zstd are available shell commands.

Parameters:
  • path_in (str, List[str]) – Input file path; can be a sequence of paths, in which case the first path will determine the working directory and the default path_out if none is given.

  • path_out (str) – Output file path; defaults to None to use the same path as path_in with .tar.zstd appended.

magmap.io.subproc_io.decompress_file(path_in, dir_out=None)[source]#

Decompress and unarchive a file.

Assumes that the file has been archived by tar and compressed by zstd, both available as shell commands.

Parameters:
  • path_in (str) – Input path.

  • dir_out (str) – Output directory path; defaults to None to output to the current directory.

magmap.io.subproc_io.test_compression(path)[source]#

Test the integrity of a file compressed by ZSTD.

Parameters:

path (str) – Path to compressed file.

Returns:

True if the integrity check completed without error; False if otherwise.

Return type:

bool