On this page:
current-find-extract-procedure
extract
extract-input
$extract-report
8.12

27 Archives🔗ℹ

 (require denxi/archive) package: denxi

denxi/archive extracts files from a single archive file.

value

current-find-extract-procedure

 : 
(parameter/c (-> path-string?
                 (or/c #f (-> input-port? any))))
A parameter used to find an extraction procedure for an archive located at a given path. The procedure in the parameter may return #f if no other procedure is available.

The default value always returns #f.

procedure

(extract in)  (subprogram/c void?)

  in : (or/c path-string? input-port?)

extract offers no control over the destination paths of extracted files. Use in-paths or path-matching to select extracted items.

Returns a subprogram P that extracts files from in with respect to (current-directory).

If in is a path-string?, then (extract in) is equivalent to (call-with-input-file in extract). The rest of this entry assumes in is an input port.

If P cannot figure out how to extract files, it will return FAILURE and log ($extract-report 'unsupported (object-name in)).

If P succeeds, it will return (void) and log ($extract-report 'done (object-name in)).

The extraction process infers the archive format from the file extension in (object-name in). If this is ".tar", then P behaves like untar. If ".tgz" or ".tar.gz", then untgz. If ".zip", unzip. Otherwise, P will attempt to use current-find-extract-procedure.

procedure

(extract-input name #:keep? any/c)  subprogram?

  name : string?
  any/c : #f
Like extract, except archive data is drawn from the input found using (input-ref name) and resolve-input. If keep? is #f, the input is released using release-input after extraction.

struct

(struct $extract-report (status target))

  status : symbol?
  target : any/c
Describes the behavior of a call to extract. target is eq? to the object-name of the input port used in the corresponding extract call.

status is