NAME

Zuzu::Module::Archive - std/archive bindings for ZuzuScript.

DESCRIPTION

Implements the std/archive module, exporting the Archive class.

This first backend concentrates on a small, portable surface: decode, encode, load, and dump.

Archive values are represented as a dict:

{
  format: "zip",
  entries: [
    { path: "hello.txt", data: BinaryString },
    { path: "nested/world.txt", data: BinaryString },
  ],
}

Only regular file entries are preserved in this API. Directory entries and other archive metadata are intentionally ignored to keep the surface small and portable.

CLASS

Archive

Static methods:

  • Archive.decode(bytes, format?)

    Decodes BinaryString archive bytes into an archive dict. When the format is omitted or auto, the backend attempts to detect it from the bytes.

  • Archive.encode(archive, format?)

    Encodes an archive dict into BinaryString bytes. The format may be taken from archive.format.

  • Archive.load(path, format?)

    Reads archive bytes from a std/io Path and decodes them.

  • Archive.dump(path, archive, format?)

    Encodes an archive dict and writes it to a std/io Path.

Perl currently supports zip, tar, tar.gz, tar.bz2, gz, and bz2.

COPYRIGHT AND LICENCE

Zuzu::Module::Archive is copyright Toby Inkster.

It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.