Skip to main content

jk_uploadpack

Introduction

This python module provides a packer/unpacker based on 'tar' that reduces redundancies before packing.

Information about this module can be found here:

Why 'uploadpack'?

Classic compression tools work very well in general. But in very specific situations these tools won't work well enough: If you need to compress data containing redundant data that can't be compressed very well. This is the case with some directory trees for web sites hosted by webservers. And precisely that was the motivation to implement uploadpack.

So uploadpack is nothing more than a tar based compression tool. In fact an uploadpack is nothing else but a tar file (possibly compressed with gz, bzip2 or xz) with a very specific structure: It avoids redundancies.

Limitations of this module

This uploadpack currently only suppors files and directories, no links.

Preliminaries

Please include an import statement for this module into your application by using the following code:

import jk_uploadpack

How to compress a directory tree to an uploadpack archive

In order to create an uploadpack you need to instantiate a packer:

up = jk_uploadpack.Packer("archive.up.gz")

Now you can create a file group (here: "foo") and add a file to it (here: "foobar.txt"):

up.fileGroup("foo").addFile("/path/to/dir/foobar.txt", "dir/foobar.txt")

Of course you can repeat that with any number of files.

After having added all files you need to close the archive:

up.close()

You must always invoke close() as otherwise essential data will not be written.

A more secure way of doing this is by using Packer with with:

with jk_uploadpack.Packer("archive.up.gz") as up:
	up.fileGroup("foo").addFile("/path/to/dir/foobar.txt", "dir/foobar.txt")

In this case close() will be called automatically.

How to uncompress an uploadpack archive

In order to decompress an uploadpack you need to instantiate an unpacker:

up = jk_uploadpack.Unpacker("archive.up.gz")

Then you can unpack all files to a target directory:

up.fileGroup("default").unpackToDir("outdir")

After having extracted all files you can close the archive:

up.close()

You should always invoke close().

A more secure way of doing this is by using Unpacker with with:

with jk_uploadpack.Unpacker("archive.up.gz") as up:
	up.fileGroup("default").unpackToDir("outdir")

In this case close() will be called automatically.

Specific Features

File Groups

uploadpack always puts files in so called file groups. File groups are organizational units that can be considered as being an archive themselves. Characterstics of such a file group are:

  • A file group is identified by a name.
  • On decompression all files of a file group are always written to a specific directory.
  • Certain parameters can be set at a file group that take effect for all files in that file group.

If you don't need to use file groups for a specific reason, use "default" as a convention.

Contact Information

Author(s):

License

This software is provided under the following license:

  • Apache Software License 2.0

Metadata

Release files for jk-uploadpack 0.2021.3.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jk-uploadpack 0.2021.3.19
File Size Uploaded
jk_uploadpack-0.2021.3.19.tar.gz 10.6 kB Details

Release files / jk_uploadpack-0.2021.3.19.tar.gz

Download URL jk_uploadpack-0.2021.3.19.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
5d5300e144c466ab5bc46a2e3a9514d5d5c1690c8c37fb66f056945fbb1b98f4
BLAKE2b-256 checksum
How to use checksums
69c91e2cd9726f9570998f720ee3d378041390b0c9d126c9476aecb3775f9ff4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.2021.3.19 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page