Jump to content

TAR archive/unarchive library/program for CraftOS

api utility lua

  • You cannot reply to this topic
No replies to this topic

#1 JackMacWindows

  • Members
  • 20 posts

Posted 02 August 2019 - 05:52 AM

I'm working on a project involving the use of TAR files (hint: it's a port of a popular Linux utility) and I figured I'd share the library I wrote to interact with TAR archives. It can read & write Unix Standard TAR (UStar) and read original TAR. I've also added permission modification if running under CCKernel2. You can either load the file as an API, or you can run the file directly, in which case it will work similarly to the GNU tar command. Running it under the shell will also provide the ability to use gzipped archives with the -z flag; this is provided by a ComputerCraft fork of the LibDeflate library by SafeteeWow. Here's the API reference:
API reference
You can use many of the switches from *nix tar on the command line, including `tar -xzf file.tar.gz` and `tar -cvf file.tar file1 file2 file3` just like on real machines. I've gotten rid of the switches that either a ) don't make sense on ComputerCraft, or b ) don't work at all on CraftOS, but much of the core functionality still works.

You can download it from the GitHub gist, which includes tar.lua + LibDeflate.lua. Note that this is BETA SOFTWARE and some functionality may be missing or buggy. I did not put it on pastebin yet since it doesn't support multiple files or keep revision history, though I might later without LibDeflate if I ever complete the CLI interface and add error checking.

Edited by JackMacWindows, 02 August 2019 - 09:18 AM.

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users