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) → stringReturns the full path of the entry.
[procedure] (tar-rec-mode tar-rec) → integerReturns the octal file mode of the entry.
[procedure] (tar-rec-uid tar-rec) → integerReturns the octal numeric user ID of the entry.
[procedure] (tar-rec-gid tar-rec) → integerReturns the octal numeric group ID of the entry.
[procedure] (tar-rec-mtime tar-rec) → integerReturns the (epoch) last modification time of the entry.
[procedure] (tar-rec-type tar-rec) → integerReturns the numeric type flag of the entry.
[procedure] (tar-rec-linkname tar-rec) → stringReturns the linked path of the entry.
[procedure] (tar-rec-uname tar-rec) → stringReturns the user name of the owner of the entry.
[procedure] (tar-rec-gname tar-rec) → stringReturns the group name of the owner of the entry.
[procedure] (tar-rec-devmajor tar-rec) → integerReturns the major device number of the entry.
[procedure] (tar-rec-devminor tar-rec) → integerReturns the minor device number of the entry.
[procedure] (tar-rec-atime tar-rec) → integerReturns the (epoch) last access time of the entry. (gnu format archives only.)
[procedure] (tar-rec-ctime tar-rec) → integerReturns the (epoch) creation time of the entry. (gnu format archives only.)
[procedure] (tar-rec-content tar-rec) → u8vectorReturns 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-recReturns 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) → voidrecords 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) → voidrecords 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) → u8vectorrecords 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) → conditionReturns a new tar condition object encapsulating the message argument (a string). This is a composite condition with the following structure:
- Kind-key exn with prop-key message.
- Kind-key snow with prop-keys type and data.
- Kind-key tar-condition.
See the (chicken condition) module for more information on condition objects.
[procedure] (tar-condition? obj) → booleanReturns true iff obj is a tar condition object.
[procedure] (tar-condition-msg condition) → stringReturns the message encapsulated by condition.
Repository
License
LGPL 2.1 or later.
History
- 1.0.1.1
- fixed missing dependency (thanks to Mario)
- 1.0.1
- initial import