Skip to content

Commit 4a7481d

Browse files
committed
docs: add documentation on how to extract distributions
In reaction to comments in #34.
1 parent 2f5aac7 commit 4a7481d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

docs/running.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,40 @@
44
Running Distributions
55
=====================
66

7+
Extracting Distributions
8+
========================
9+
10+
Distributions are defined as zstandard-compressed tarballs.
11+
12+
Modern versions of ``tar`` support zstandard and you can extract
13+
like any normal archive::
14+
15+
$ tar -axvf path/to/distribution.tar.zstd
16+
17+
(The ``-a`` argument tells tar to guess the compression format by
18+
the file extension.)
19+
20+
If you do not have ``tar``, you can install and use the ``zstd``
21+
tool (typically available via a ``zstd`` or ``zstandard`` system
22+
package)::
23+
24+
$ zstd -d path/to/distribution.tar.zstd
25+
$ tar -xvf path/to/distribution.tar
26+
27+
If you want to extract the distribution with Python, use the
28+
``zstandard`` Python package:
29+
30+
.. code-block:: python
31+
32+
import tar
33+
import zstandard
34+
35+
with open("path/to/distribution.tar.zstd", "rb") as ifh:
36+
dctx = zstandard.ZstdDecompressor()
37+
with dctx.stream_reader(ifh) as reader:
38+
with tarfile.open(mode="r|", fileobj=reader) as tf:
39+
tf.extractall("path/to/output/directory")
40+
741
Runtime Requirements
842
====================
943

0 commit comments

Comments
 (0)