OC-misc/mtar
Izaya 776e19df41 close file handles when we're done reading them 2023-11-13 22:12:18 +10:00
..
OpenOS/usr close file handles when we're done reading them 2023-11-13 22:12:18 +10:00
README.md updated to differentiate between v0 and v1 archives 2021-05-27 15:27:57 +10:00
libmtar.lua updated liblz16 and libmtar to use string.(un)pack and support bigger files 2021-05-26 17:49:42 +10:00

README.md

mtar - Minitel Archiver

mtar is a file format for storing multiple files in a single file, much like tar, cpio or zip.

File format

mtar archive files consist of a number of file entries, in any combination of the following formats:

v1 format

  • 0xFFFF (for differentiating versioned headers from legacy v0 headers)
  • version byte, with the value 1
  • 2 bytes file name length
  • the file name
  • 8 bytes file content length
  • the file contents

Legacy v0 format

  • 2 bytes file name length
  • the file name
  • 2 bytes file content length
  • the file contents

Archives are terminated either by the end of file, or a record with a name length of zero.

libmtar

libmtar is the reference implementation of mtar. It provides two functions:

  • libmtar.genHeader(string: name, number: len): string
    Generates an mtar file header for a file called name that is len bytes long.
  • libmtar.iter(table: stream): function
    Given buffer stream, returns an iterator suitable for use with for that returns, for each iteration, the file name, a function to read from the file, and the length of the file.