data.webtools.download_tarball_link¶
Function ยท Source
mdnc.data.webtools.download_tarball_link(
link, path='.', mode='auto', verbose=False
)
Download an online tarball from a web link, and extract it automatically. This function is equivalent to using wget
. For example, downloading a xz
file:
wget -O- <link>.tar.xz | tar xJ -C <path>/ || fail
The tarball is directed by the link. The tarball would be sent to pipeline and not get stored.
Now supports gz
, bz2
or xz
format, see tarfile to view the details.
Arguments¶
Requries
Argument | Type | Description |
---|---|---|
link | str | The whole web link, pointting to or redicted to the data file. |
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 |
|
Get share-pixmaps.tar.xz: 134kB [00:00, 1.65MB/s]
Last update: March 14, 2021