Skip to content

ChanTsune/Portable-Network-Archive

Portable Network Archive (PNA)

Crates.io Downloads Docs.rs Test License

PNA

Portable Network Archive (PNA) is a flexible, secure, and cross-platform archive format inspired by the PNG data structure. It combines the simplicity of ZIP with the robustness of TAR, providing efficient compression, strong encryption, and seamless splitting and streaming capabilities.

Why PNA?

Portable Network Archive (PNA): A Flexible, Secure, and Cross-Platform Archive Format

  • Portability: Works seamlessly across multiple platforms, combining the strengths of TAR and ZIP formats.
  • Compression Flexibility: Advanced per-file and archive-wide compression options reduce the need for full archive decompression.
  • Encryption & Security: Supports 256-bit AES and Camellia for robust protection of sensitive data.
  • Splittable Structure: Based on PNG’s data unit structure, enabling the easy division of large archives into smaller parts.
  • Streamability: Supports serial read and write operations, making it suitable for streaming processing, similar to a TAR format.
  • Extensibility: Designed to accommodate future extensions and private add-ons, ensuring compatibility with the basic PNA format while allowing for flexible customization.
  • Error Resilience: File integrity checks and error detection ensure data is secure during transmission.

Additionally, the PNA specification includes a rationale appendix to help developers understand key design choices, making implementation more straightforward.

Minimal archives (metadata-free by design)

Many archive formats require a non-trivial amount of metadata (timestamps, permissions, owner ids, directory tables, checksums, etc.) to be present even when you do not want to preserve them.

PNA is intentionally designed so that everything other than the entry name and the entry body can be optional. In other words, it is possible (by design, without violating the specification) to build an archive that contains only:

  • the file name (entry identifier), and
  • the file body (payload bytes)

and omit all other information.

This enables a few practical advantages:

  • Smallest possible archives: no overhead from timestamps, permissions, comments, or other ancillary fields when they are unnecessary.
  • Privacy / information minimization: avoids unintentionally leaking environment details such as mtime, uid/gid, filesystem attributes, tool versions, etc.
  • Deterministic / reproducible packaging: fewer variable fields means it is easier to produce stable byte-for-byte outputs across environments.
  • Clean transport container: when used as a network-friendly container, the archive can carry exactly what the sender intends—no more, no less.

Features

  • File Compression and Decompression

    • Supports zlib, zstd, and xz.
  • File Encryption and Decryption

    • Supports 256-bit AES and 256-bit Camellia.
  • Solid Mode

    • Compresses and encrypts the entire archive as a single block.
  • File Attribute Preservation (Maintains and restores)

    • File permissions.
    • File timestamps.
    • Extended attributes.
    • Access Control Lists (ACLs) (experimental).

CLI Supported Platform

  • Cross-platform support including Windows, Linux, macOS, and FreeBSD
    (Support for additional platforms planned.)

Installation

Via Shell (Prebuilt Binary)

On Linux or macOS

curl --proto '=https' --tlsv1.2 -LsSf 'https://github.com/ChanTsune/Portable-Network-Archive/releases/latest/download/portable-network-archive-installer.sh' | sh

On Windows

powershell -ExecutionPolicy Bypass -c "irm https://github.com/ChanTsune/Portable-Network-Archive/releases/latest/download/portable-network-archive-installer.ps1 | iex"

Via Cargo

cargo install portable-network-archive

From Source (via Cargo)

cargo install --git https://github.com/ChanTsune/Portable-Network-Archive.git portable-network-archive

Usage

PNA-native style

pna create -f archive.pna file1.txt file2.txt
pna extract -f archive.pna
pna list -f archive.pna

tar-like style

If you prefer tar-like syntax, a bsdtar-compatible interface is available:

pna compat bsdtar -cf archive.pna file1.txt file2.txt
pna compat bsdtar -xf archive.pna
pna compat bsdtar -tf archive.pna

Both styles produce PNA-format archives. Note that compat bsdtar preserves permissions, ownership, and timestamps by default (matching bsdtar behavior), while PNA-native commands require explicit flags to preserve them.

For more commands and options:

pna --help

See also the CLI Reference for detailed command documentation.

Specification

Detailed information is available in the Specification document.

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

PNA (Portable Network Archive) is a highly scalable archive format that can be compressed, encrypted, and split. Also, its data structure is inspired by the PNG data structure.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Packages

 
 
 

Contributors