testcorrupt: use mkstemp() to create tempfile
[rarfile.git] / FAQ
blobc1b506c33ee895de5c2f908608ca43d85ab910ae
2 rarfile FAQ
3 ===========
5 What are the dependencies?
6 --------------------------
8 It depends on ``unrar`` command-line utility to do the actual decompression.
10 Note that by default it expect it to be in ``PATH``.  If unrar
11 launching fails, you need to fix this.
13 Does it parse ``unrar`` output to get archive contents?
14 -------------------------------------------------------
16 No, ``rarfile`` parses RAR structure in Python code.  Also it can
17 read uncompressed files from archive without external utility.
19 Will rarfile support wrapping unrarlib/unrar.dll/unrar.so in the future?
20 ------------------------------------------------------------------------
22 No.  The current architecture - parsing in Python and decompression with
23 command line tools work well across all interesting operating systems
24 (Windows/Linux/MacOS), wrapping a library does not bring any advantages.
26 Simple execution of command-line tools is also legally simpler situation
27 than linking with external library.
29 How can I get it work on Windows?
30 ---------------------------------
32 On Windows the ``unrar.exe`` is not in ``PATH`` so simple ``Popen("unrar ..")`` does not work.
33 It can be solved several ways:
35 1. Add location of ``unrar.exe`` to PATH.
36 2. Set rarfile.UNRAR_TOOL to full path of ``unrar.exe``.
37 3. Copy ``unrar.exe`` to your program directory.
38 4. Copy ``unrar.exe`` to system directory that is in PATH, eg. ``C:\Windows``.
40 How to avoid the need for user to manually install rarfile/unrar?
41 -----------------------------------------------------------------
43 Include ``rarfile.py`` and/or ``unrar`` with your application.
45 Will it support creating RAR archives?
46 --------------------------------------
48 No.  RARLAB_ is not interested in RAR becoming open format
49 and specifically discourages writing RAR creation software.
51 In the meantime use either Zip_ (better compatibility) or 7z_ (better compression)
52 format for your own archives.
54 .. _RARLAB: http://www.rarlab.com/
55 .. _Zip: http://en.wikipedia.org/wiki/ZIP_%28file_format%29
56 .. _7z:  http://en.wikipedia.org/wiki/7z
58 What is the USE_EXTRACT_HACK?
59 -----------------------------
61 RarFile uses ``unrar`` to extract compressed files.  But when extracting
62 single file from archive containing many entries, ``unrar`` needs to parse
63 whole archive until it finds the right entry.  This makes random-access
64 to entries slow.  To avoid that, RarFile remembers location of compressed
65 data for each entry and on read it copies it to temporary archive containing
66 only data for that one file, thus making ``unrar`` fast.
68 The logic is only activated for entries smaller than HACK_SIZE_LIMIT
69 (20M by default).  Bigger files are accessed directly from RAR.
71 Note - it only works for non-solid archives.  So if you care about
72 random access to files in your archive, do not create solid archives.