On this page:

7 tar File Extraction

 (require file/untar) package: base
The file/untar library provides a function to extract items from a TAR/USTAR archive using GNU and/or pax extensions to support long pathnames.


(untar in    
  [#:dest dest-path    
  #:strip-count strip-count    
  #:permissive? permissive?    
  #:filter filter-proc])  void?
  in : (or/c path-string? input-port?)
  dest-path : (or/c path-string? #f) = #f
  strip-count : exact-nonnegative-integer? = 0
  permissive? : any/c = #f
  filter-proc : 
(path? (or/c path? #f)
 symbol? exact-integer? (or/c path? #f)
 . -> . any/c)
   = (lambda args #t)
Extracts TAR/USTAR content from in, recognizing POSIX.1-2001/pax and GNU extensions for long paths and long symbolic-link targets.

If dest-path is not #f, every path in the archive is prefixed to determine the destination path of the extracted item.

If strip-count is positive, then strip-count path elements are removed from the item path from the archive (before prefixing the path with dest-path); if the item’s path contains strip-count elements, then it is not extracted.

Unless permissive? is true, then archive items with paths containing an up-directory indicator are disallowed, and a link item whose target is an absolute path or contains an up-directory indicator is also disallowed. Absolute paths are always disallowed. A disallowed path triggers an exception.

For each item in the archive, filter-proc is applied to

If the result of filter-proc is #f, then the item is not unpacked.

Changed in version 6.3 of package base: Added the #:permissive? argument. Changed in version Support long paths and long symbolic-link targets using POSIX.1-2001/pax and GNU extensions.