Skip to main content

Package a directory to a file, with fast file access and compression support

Project description

PyPI PyPI - Python Version Build Status Documentation Status codecov Codacy Badge

fast_package_file

Package a directory to a file, with fast file access and compression support

import fast_package_file

# Package a directory into a file
fast_package_file.build('a_directory', 'a_package.file')

# Prepare a package file
data_package = fast_package_file.PackagedDataFile('a_package.file')

# Load a file from the packed directory and save it
with open('any.file', 'wb') as any_file:
  data_package.load_file('path\\to\\any.file')

# Or just get the raw binary data
from PIL import Image
i = Image.open(io.BytesIO(data_package.load_file('image.png')))

# Some other useful functions
data_package.load_bulk(prefix='audio\\sfx\\', postfix='.wav')
fast_package_file.oneshot('a_package.file', 'path\\to\\any.file')
fast_package_file.oneshot_bulk('a_package.file', prefix='audio\\sfx\\', postfix='.wav')

Installation

From PyPI:

pip install fast-package-file

Or from Github:

pip install git+git://github.com/Kataiser/fast-package-file.git@master#egg=fast_package_file

Documentation

More details will be available at https://fast-package-file.readthedocs.io/en/latest/

Features

  • Is fast because only the data needed is loaded from the package file, total package size is irrelevant
  • Obfuscates files from (most) users
  • Like a .zip file, but doesn't decompress the entire thing when reading just one file
  • Includes the entire directory and subdirectories, not just surface-level files
  • Files are compressed with Gzip, but only if compression improves file size (per file) and is enabled (per package file)
  • Pretty good error handling when loading package files, just catch fast_package_file.PackageDataError
  • Inspired by video game packaging, such as UE4's .pak or GTA V's .rpf formats
  • Cross-platform, has CI for Linux, MacOS, and Windows

Contribute

License

The project is licensed under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fast_package_file-1.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

fast_package_file-1.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file fast_package_file-1.1.tar.gz.

File metadata

  • Download URL: fast_package_file-1.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for fast_package_file-1.1.tar.gz
Algorithm Hash digest
SHA256 46bea46f9c363d4435c5b88d14cad39fdc10dfdc29be28bbd744702ee77519ca
MD5 b81e64ed4a490165966dd9d2d40661fa
BLAKE2b-256 b44f67cf6f6f0aed8682581ffe646bbb2c8ba358ae9b962f971fe273dd8b3f85

See more details on using hashes here.

File details

Details for the file fast_package_file-1.1-py3-none-any.whl.

File metadata

  • Download URL: fast_package_file-1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

File hashes

Hashes for fast_package_file-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a5c4860efdffe9f84030c73170d6440dd2c8ff283ef3d836ff24e387c9641bcd
MD5 7917971f8334bc3551492086c9fd60de
BLAKE2b-256 c772af75c71905c88a34a787186226191aed183f1ae12431221b758799625a2d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page