Skip to content

data.webtools.download_tarball_public

Function ยท Source

mdnc.data.webtools.download_tarball_public(
    user, repo, tag, asset,
    path='.', mode='auto', verbose=False
)

Download an online tarball from a Github release asset, and extract it automatically (public).

This tool only supports public github repositories. This method could be replaced by mdnc.data.webtools.download_tarball_link, but we do not recommend to do that. Compared to that method, this function is more robust, because it fetches the meta-data before downloading the dataset.

Now supports gz, bz2 or xz format, see tarfile to view the details.

Warning

This function is only designed for downloading public data. If your repository is private, please use mdnc.data.webtools.download_tarball_private for instead. Certainly, using the general interface mdnc.data.webtools.download_tarball is more recommended.

Arguments

Requries

Argument Type Description
user str The Github owner name of the repository, could be an organization.
repo str The Github repository name.
tag str The Github release tag where the data is uploaded.
asset str The github asset (tarball) name (including the file name postfix) to be downloaded.
path str The extracted data root path. Should be a folder path.
mode str The mode of extraction. Could be 'gz', 'bz2', 'xz' or 'auto'. When using 'auto', the format would be guessed by the posfix of the file name in the link.
verbose bool A flag, whether to show the downloaded size during the web request.

Examples

Example
1
2
3
import mdnc

mdnc.data.webtools.download_tarball_public(user='cainmagi', repo='Dockerfiles', tag='xubuntu-v1.5-u20.04', asset='xconfigs-u20-04.tar.xz', path='./downloads', verbose=True)
Get xconfigs-u20-04.tar.xz: 3.06kB [00:00, 263kB/s]

Last update: March 14, 2021

Comments