Skip to content

Commit

Permalink
Added a file format page to the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kataiser committed Jul 6, 2019
1 parent 9ad5770 commit 0c0e73b
Show file tree
Hide file tree
Showing 19 changed files with 325 additions and 4 deletions.
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file added docs/_build/doctrees/guide/format.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/guide/funcs.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/index.doctree
Binary file not shown.
3 changes: 2 additions & 1 deletion docs/_build/html/_modules/fast_package_file.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@

<ul>
<li class="toctree-l1"><a class="reference internal" href="../guide/funcs.html">Function reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="../guide/format.html">Packaged data file format</a></li>
</ul>


Expand Down Expand Up @@ -363,7 +364,7 @@ <h1>Source code for fast_package_file</h1><div class="highlight"><pre>
<span class="sd"> compress every file no matter what.</span>
<span class="sd"> :param hash_mode: The hash method to use to ensure file validity. Can be &quot;md5&quot; or &quot;sha256&quot;. If :py:class:`None` (the default), only the first and last bytes are compared.</span>
<span class="sd"> :param comp_func: A supplied decompression function that takes :py:class:`bytes` and returns :py:class:`bytes`. Some recommendations: LZMA, LZMA2, Deflate, BZip2, Oodle, or Zstandard.</span>
<span class="sd"> :param crc32_paths: Store file paths as `crc32 &lt;https://en.wikipedia.org/wiki/Cyclic_redundancy_check&gt;`_ numbers.</span>
<span class="sd"> :param crc32_paths: Store file paths as `crc32 &lt;https://en.wikipedia.org/wiki/Cyclic_redundancy_check&gt;`_ numbers. Useful for obfuscating file names and paths.</span>
<span class="sd"> :param progress_bar: Whether to show a progress bar (uses `tqdm &lt;https://github.com/tqdm/tqdm&gt;`_). If tqdm isn&#39;t installed, this is irrelevant.</span>
<span class="sd"> :param silent: Disable all prints.</span>
<span class="sd"> &quot;&quot;&quot;</span>
Expand Down
1 change: 1 addition & 0 deletions docs/_build/html/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@

<ul>
<li class="toctree-l1"><a class="reference internal" href="../guide/funcs.html">Function reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="../guide/format.html">Packaged data file format</a></li>
</ul>


Expand Down
32 changes: 32 additions & 0 deletions docs/_build/html/_sources/guide/format.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Packaged data file format
-------------------------

Although the builder and loader for this format are implemented in Python, the format can of course be read by any languange.

* ``0x00`` (8-byte unsigned little-endian int): Size of the file location header, in bytes, as stored in the file (i.e. after compression).
* ``0x08`` (1-byte bool): Whether the header is compressed (not including these first 10 bytes, which are never compressed).
* ``0x09`` (1-byte bool): Whether the file paths use crc32 encoding.
* ``0x0A`` (UTF-8 string): The file location header, as JSON.
* The rest is file data, placed end-to-end.

File location header (JSON)
^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: none
{"folder\\file1.txt":
[file location, relative to the end of the entire header (int),
file size, after compression if enabled (int),
file is compressed (bool),
first byte of file (int),
last byte of file (int)],
"folder\\file2.txt": [...], ...}
.. note::
This example is multi-line for readability, but the actual format has no newlines.

.. note::
File paths are stored as actual double backslashes (``\\``). Python's JSON loader handles this automatically, make sure yours does or reformat the string.

.. note::
If using crc32 file paths, they are stored as strings of integers.
1 change: 1 addition & 0 deletions docs/_build/html/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Usage guide
:maxdepth: 2

guide/funcs
guide/format

Contribute
----------
Expand Down
1 change: 1 addition & 0 deletions docs/_build/html/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@

<ul>
<li class="toctree-l1"><a class="reference internal" href="guide/funcs.html">Function reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="guide/format.html">Packaged data file format</a></li>
</ul>


Expand Down
241 changes: 241 additions & 0 deletions docs/_build/html/guide/format.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@


<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Packaged data file format &mdash; fast-package-file 1.1 documentation</title>








<script type="text/javascript" src="../_static/js/modernizr.min.js"></script>


<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script>

<script type="text/javascript" src="../_static/js/theme.js"></script>




<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="prev" title="Function reference" href="funcs.html" />
</head>

<body class="wy-body-for-nav">


<div class="wy-grid-for-nav">

<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >



<a href="../index.html" class="icon icon-home"> fast-package-file



</a>




<div class="version">
1.1
</div>




<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>


</div>

<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">






<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="funcs.html">Function reference</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Packaged data file format</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#file-location-header-json">File location header (JSON)</a></li>
</ul>
</li>
</ul>



</div>
</div>
</nav>

<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">


<nav class="wy-nav-top" aria-label="top navigation">

<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">fast-package-file</a>

</nav>


<div class="wy-nav-content">

<div class="rst-content">

















<div role="navigation" aria-label="breadcrumbs navigation">

<ul class="wy-breadcrumbs">

<li><a href="../index.html">Docs</a> &raquo;</li>

<li>Packaged data file format</li>


<li class="wy-breadcrumbs-aside">


<a href="../_sources/guide/format.rst.txt" rel="nofollow"> View page source</a>


</li>

</ul>


<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">

<div class="section" id="packaged-data-file-format">
<h1>Packaged data file format<a class="headerlink" href="#packaged-data-file-format" title="Permalink to this headline"></a></h1>
<p>Although the builder and loader for this format are implemented in Python, the format can of course be read by any languange.</p>
<blockquote>
<div><ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">0x00</span></code> (8-byte unsigned little-endian int): Size of the file location header, in bytes, as stored in the file (i.e. after compression).</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">0x08</span></code> (1-byte bool): Whether the header is compressed (not including these first 10 bytes, which are never compressed).</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">0x09</span></code> (1-byte bool): Whether the file paths use crc32 encoding.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">0x0A</span></code> (UTF-8 string): The file location header, as JSON.</p></li>
<li><p>The rest is file data, placed end-to-end.</p></li>
</ul>
</div></blockquote>
<div class="section" id="file-location-header-json">
<h2>File location header (JSON)<a class="headerlink" href="#file-location-header-json" title="Permalink to this headline"></a></h2>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>{&quot;folder\\file1.txt&quot;:
[file location, relative to the end of the entire header (int),
file size, after compression if enabled (int),
file is compressed (bool),
first byte of file (int),
last byte of file (int)],
&quot;folder\\file2.txt&quot;: [...], ...}
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>This example is multi-line for readability, but the actual format has no newlines.</p>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>File paths are stored as actual double backslashes (<code class="docutils literal notranslate"><span class="pre">\\</span></code>). Python’s JSON loader handles this automatically, make sure yours does or reformat the string.</p>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>If using crc32 file paths, they are stored as strings of integers.</p>
</div>
</div>
</div>


</div>

</div>
<footer>

<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">


<a href="funcs.html" class="btn btn-neutral float-left" title="Function reference" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>

</div>


<hr/>

<div role="contentinfo">
<p>
&copy; Copyright 2019, Kataiser

</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.

</footer>

</div>
</div>

</section>

</div>



<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>






</body>
</html>
6 changes: 5 additions & 1 deletion docs/_build/html/guide/funcs.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Packaged data file format" href="format.html" />
<link rel="prev" title="fast_package_file" href="../index.html" />
</head>

Expand Down Expand Up @@ -90,6 +91,7 @@
<li class="toctree-l2"><a class="reference internal" href="#helpers">Helpers</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="format.html">Packaged data file format</a></li>
</ul>


Expand Down Expand Up @@ -172,7 +174,7 @@ <h1>Function reference<a class="headerlink" href="#function-reference" title="Pe
compress every file no matter what.</p></li>
<li><p><strong>hash_mode</strong> – The hash method to use to ensure file validity. Can be “md5” or “sha256”. If <code class="xref py py-class docutils literal notranslate"><span class="pre">None</span></code> (the default), only the first and last bytes are compared.</p></li>
<li><p><strong>comp_func</strong> – A supplied decompression function that takes <code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code> and returns <code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>. Some recommendations: LZMA, LZMA2, Deflate, BZip2, Oodle, or Zstandard.</p></li>
<li><p><strong>crc32_paths</strong> – Store file paths as <a class="reference external" href="https://en.wikipedia.org/wiki/Cyclic_redundancy_check">crc32</a> numbers.</p></li>
<li><p><strong>crc32_paths</strong> – Store file paths as <a class="reference external" href="https://en.wikipedia.org/wiki/Cyclic_redundancy_check">crc32</a> numbers. Useful for obfuscating file names and paths.</p></li>
<li><p><strong>progress_bar</strong> – Whether to show a progress bar (uses <a class="reference external" href="https://github.com/tqdm/tqdm">tqdm</a>). If tqdm isn’t installed, this is irrelevant.</p></li>
<li><p><strong>silent</strong> – Disable all prints.</p></li>
</ul>
Expand Down Expand Up @@ -326,6 +328,8 @@ <h2>Helpers<a class="headerlink" href="#helpers" title="Permalink to this headli

<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">

<a href="format.html" class="btn btn-neutral float-right" title="Packaged data file format" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>


<a href="../index.html" class="btn btn-neutral float-left" title="fast_package_file" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>

Expand Down
5 changes: 5 additions & 0 deletions docs/_build/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@

<ul>
<li class="toctree-l1"><a class="reference internal" href="guide/funcs.html">Function reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="guide/format.html">Packaged data file format</a></li>
</ul>


Expand Down Expand Up @@ -208,6 +209,10 @@ <h2>Usage guide<a class="headerlink" href="#usage-guide" title="Permalink to thi
<li class="toctree-l2"><a class="reference internal" href="guide/funcs.html#helpers">Helpers</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="guide/format.html">Packaged data file format</a><ul>
<li class="toctree-l2"><a class="reference internal" href="guide/format.html#file-location-header-json">File location header (JSON)</a></li>
</ul>
</li>
</ul>
</div>
</div>
Expand Down
Binary file modified docs/_build/html/objects.inv
Binary file not shown.
1 change: 1 addition & 0 deletions docs/_build/html/py-modindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@

<ul>
<li class="toctree-l1"><a class="reference internal" href="guide/funcs.html">Function reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="guide/format.html">Packaged data file format</a></li>
</ul>


Expand Down
1 change: 1 addition & 0 deletions docs/_build/html/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@

<ul>
<li class="toctree-l1"><a class="reference internal" href="guide/funcs.html">Function reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="guide/format.html">Packaged data file format</a></li>
</ul>


Expand Down

0 comments on commit 0c0e73b

Please sign in to comment.