modulegraph.zipio — Read-only filesystem access

This module contains a number of functions that mirror functions found in os and os.path, but have support for data inside zipfiles as well as regular filesystem objects.

The path argument of all functions below can refer to an object on the filesystem, but can also refer to an entry inside a zipfile. In the latter case, a prefix of path will be the name of zipfile while the rest refers to an object in that zipfile. As an example, when somepath/mydata.zip is a zipfile the path somepath/mydata.zip/somefile.txt will refer to somefile.txt inside the zipfile.

modulegraph.zipio.open(path[, mode])

Open a file, like the built-in open function.

The mode defaults to "r" and must be either "r" or "rb".

modulegraph.zipio.listdir(path)

List the contents of a directory, like os.listdir().

modulegraph.zipio.isfile(path)

Returns true if path exists and refers to a file.

Raises IOError when path doesn’t exist at all.

Based on os.path.isfile()

modulegraph.zipio.isdir(path)

Returns true if path exists and refers to a directory.

Raises IOError when path doesn’t exist at all.

Based on os.path.isdir()

Returns true if path exists and refers to a symbolic link.

Raises IOError when path doesn’t exist at all.

Based on os.path.islink()

Returns the contents of a symbolic link, like os.readlink().

modulegraph.zipio.getmtime(path)

Returns the last modifiction time of a file or directory, like os.path.getmtime().

modulegraph.zipio.getmode(path)

Returns the UNIX file mode for a file or directory, like the st_mode attribute in the result of os.stat(), but excluding the file type.