snowtar

This egg provides procedures for reading tar files. It is capable of reading and writing files in the ustar, gnu, and v7 tar formats.

This is a port of the Scheme Now! tar package.

Author

Marc Feeley

Ported to CHICKEN by felix winkelmann.

Requirements

The miscmacros egg is required.

Record type

Tar entries are represented by the tar-rec record type.

Accessors

See the documentation of the various tar formats for further details on these fields. Some formats may not support all fields; if a given field is not supported, its accessor will return #f.

[procedure] (tar-rec-name tar-rec) → string

Returns the full path of the entry.

[procedure] (tar-rec-mode tar-rec) → integer

Returns the octal file mode of the entry.

[procedure] (tar-rec-uid tar-rec) → integer

Returns the octal numeric user ID of the entry.

[procedure] (tar-rec-gid tar-rec) → integer

Returns the octal numeric group ID of the entry.

[procedure] (tar-rec-mtime tar-rec) → integer

Returns the (epoch) last modification time of the entry.

[procedure] (tar-rec-type tar-rec) → integer

Returns the numeric type flag of the entry.

[procedure] (tar-rec-linkname tar-rec) → string

Returns the linked path of the entry.

[procedure] (tar-rec-uname tar-rec) → string

Returns the user name of the owner of the entry.

[procedure] (tar-rec-gname tar-rec) → string

Returns the group name of the owner of the entry.

[procedure] (tar-rec-devmajor tar-rec) → integer

Returns the major device number of the entry.

[procedure] (tar-rec-devminor tar-rec) → integer

Returns the minor device number of the entry.

[procedure] (tar-rec-atime tar-rec) → integer

Returns the (epoch) last access time of the entry. (gnu format archives only.)

[procedure] (tar-rec-ctime tar-rec) → integer

Returns the (epoch) creation time of the entry. (gnu format archives only.)

[procedure] (tar-rec-content tar-rec) → u8vector

Returns the file data of the entry.

Constructor

[procedure] (make-tar-rec name mode uid gid mtime type linkname uname gname devmajor devminor atime ctime content) → tar-rec

Returns a new tar-rec. Fields may be omitted by passing #f for the corresponding argument. See the Accessor documentation above for the types of the arguments.

Procedures

Packing

[procedure] (tar-pack-genport records port) → void

records must be a list of tar-rec objects. port must be an output port.

Writes a tar archive containing the records to port. Raises an exception (a tar condition object) if any of the records contain unsupported fields or invalid field contents. Currently, the data is in ustar format.

[procedure] (tar-pack-file records path) → void

records must be a list of tar-rec objects. path must be a string describing a valid path.

Writes a tar archive containing the records to the file named by path. Raises an exception (a tar condition object) if any of the records contain unsupported fields or invalid field contents. Currently, the data is in ustar format.

[procedure] (tar-pack-u8vector records) → u8vector

records must be a list of tar-rec objects.

Encodes the records as a tar archive and returns this data as a u8vector. Raises an exception (a tar condition object) if any of the records contain unsupported fields or invalid field contents. Currently, the data is in ustar format.

Unpacking

[procedure] (tar-unpack-genport port) → list[tar-rec]

Decodes tar data from port and returns it as a list of tar records. Raises an exception (a tar condition object) if decoding fails for some reason.

[procedure] (tar-unpack-file path) → list[tar-rec]

Decodes tar data from the file named by path and returns it as a list of tar records. Raises an exception (a tar condition object) if decoding fails for some reason.

[procedure] (tar-unpack-u8vector u8vector) → list[tar-rec]

Decodes tar data from u8vector and returns it as a list of tar records. Raises an exception (a tar condition object) if decoding fails for some reason.

Conditions

[procedure] (make-tar-condition message) → condition

Returns a new tar condition object encapsulating the message argument (a string). This is a composite condition with the following structure:

See the (chicken condition) module for more information on condition objects.

[procedure] (tar-condition? obj) → boolean

Returns true iff obj is a tar condition object.

[procedure] (tar-condition-msg condition) → string

Returns the message encapsulated by condition.

Repository

GitHub

License

LGPL 2.1 or later.

History

1.0.1.1
fixed missing dependency (thanks to Mario)
1.0.1
initial import