Skip to content

Instantly share code, notes, and snippets.

@fukamachi
Last active May 8, 2022 03:04
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save fukamachi/6364983 to your computer and use it in GitHub Desktop.
Save fukamachi/6364983 to your computer and use it in GitHub Desktop.
A Common Lisp function to extract a tarball (.tar.gz) file to a directory (*default-pathname-defaults*).
(ql:quickload '(chipz archive))
(defun extract-tarball (pathname)
"Extract a tarball (.tar.gz) file to a directory (*default-pathname-defaults*)."
(with-open-file (tarball-stream pathname
:direction :input
:element-type '(unsigned-byte 8))
(archive::extract-files-from-archive
(archive:open-archive 'archive:tar-archive
(chipz:make-decompressing-stream 'chipz:gzip tarball-stream)
:direction :input))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment