←  APIs and Utilities

ComputerCraft | Programmable Computers for Minecraft

»

Packager - Compress a folder into a single...

CrazedProgrammer's Photo CrazedProgrammer 18 Mar 2015

Packager is a really useful program if you want to compress a folder into a single executable file (to publish on pastebin for example).
Usage:
packager <directory> <output file> [display name]

When you run packager it will compress a folder into a file (note that the paths are relative unless it starts with an /).
When you run the file it will ask:
Where do you want to extract <display name>?
If a file/directory with the same name already exists, it will be deleted.
Note: You can not compress files that have bytes higher than 127.

Download:
pastebin get Wy5vb6p0 packager

If you have any suggestions, bug reports or questions then please leave a reply.
Edited by CrazedProgrammer, 02 April 2015 - 12:18 PM.
Quote

Lupus590's Photo Lupus590 18 Mar 2015

Self extracting files, I've been waiting for one of these. Does it actually compress (make the files smaller) too?
Edited by Lupus590, 18 March 2015 - 10:15 PM.
Quote

CrazedProgrammer's Photo CrazedProgrammer 19 Mar 2015

 Lupus590, on 18 March 2015 - 10:13 PM, said:

Self extracting files, I've been waiting for one of these. Does it actually compress (make the files smaller) too?
Nope, it converts the contents to base64 so you can upload binary files to pastebin.
Quote

Lupus590's Photo Lupus590 19 Mar 2015

Feature request, file size shrinking (bonus for IRL compressed file format, .7z .zip .tar.gz - someone has made tar format)
Edited by Lupus590, 20 March 2015 - 07:56 AM.
Quote

Geforce Fan's Photo Geforce Fan 19 Mar 2015

 CrazedProgrammer, on 19 March 2015 - 07:02 AM, said:

so you can upload binary files to pastebin.
This allows you to upload binary files? YESSSSSSSSS I've been needing this!!!!!!!!!!!
Right now, when installing game-engine, the testing map is stored as a table and is converted by the installer. So it's a pointless fs call.
Quote

MKlegoman357's Photo MKlegoman357 20 Mar 2015

 Geforce Fan, on 19 March 2015 - 11:15 PM, said:

 CrazedProgrammer, on 19 March 2015 - 07:02 AM, said:

so you can upload binary files to pastebin.
This allows you to upload binary files? YESSSSSSSSS I've been needing this!!!!!!!!!!!
Right now, when installing game-engine, the testing map is stored as a table and is converted by the installer. So it's a pointless fs call.

And what about Bomb Bloke's script? It does the same, and even more - compression!
Quote

CrazedProgrammer's Photo CrazedProgrammer 20 Mar 2015

 MKlegoman357, on 20 March 2015 - 06:46 AM, said:

 Geforce Fan, on 19 March 2015 - 11:15 PM, said:

 CrazedProgrammer, on 19 March 2015 - 07:02 AM, said:

so you can upload binary files to pastebin.
This allows you to upload binary files? YESSSSSSSSS I've been needing this!!!!!!!!!!!
Right now, when installing game-engine, the testing map is stored as a table and is converted by the installer. So it's a pointless fs call.

And what about Bomb Bloke's script? It does the same, and even more - compression!
Wow that looks nice! But it doesn't support empty directories.
I will probably add compression in the future.

 Lupus590, on 19 March 2015 - 07:43 AM, said:

Feature request, file size shrinking (bonus for IRL compressed file format, .7z .zip .tar.gz - someone has made tar format)
I will add compression soon!
Quote

Lupus590's Photo Lupus590 20 Mar 2015

I found that post with the .tar format archiver, I've added it to my previous post too.
http://www.computerc...ar-files-in-cc/
Quote

CrazedProgrammer's Photo CrazedProgrammer 20 Mar 2015

 Lupus590, on 20 March 2015 - 07:57 AM, said:

I found that post with the .tar format archiver, I've added it to my previous post too.
http://www.computerc...ar-files-in-cc/
Thanks, but the file should be executable in CC.
I'm going to search for some simple compression algorithms in lua.
Quote

Mr. Bateman's Photo Mr. Bateman 20 Mar 2015

 Lupus590, on 20 March 2015 - 07:57 AM, said:

I found that post with the .tar format archiver, I've added it to my previous post too.
http://www.computerc...ar-files-in-cc/
That implementation doesn't have compression, so it's useless in this regard.

 CrazedProgrammer, on 20 March 2015 - 08:05 AM, said:

Thanks, but the file should be executable in CC.
I'm going to search for some simple compression algorithms in lua.
Keep in mind that you have to put the decompression script in every packaged file so it can decompress itself, so stay clear of any 30kb Huffman encoding algorithms.
Quote

Lupus590's Photo Lupus590 20 Mar 2015

 Mr. Bateman, on 20 March 2015 - 11:41 PM, said:

-snip-

The point was that someone had made a program that used a real life file format. I did reference my previous post, maybe you should have read it.
Quote

Mr. Bateman's Photo Mr. Bateman 21 Mar 2015

 Lupus590, on 20 March 2015 - 11:55 PM, said:

The point was that someone had made a program that used a real life file format. I did reference my previous post, maybe you should have read it.
Assuming this is the post in question:

 Lupus590, on 19 March 2015 - 07:43 AM, said:

Feature request, file size shrinking (bonus for IRL compressed file format, .7z .zip .tar.gz - someone has made tar format)
\
You're asking for compression, and you state that it's a "bonus" if a real life format was used. The TAR implementation in CC doesn't support compression, so the first criteria is invalidated, therefore providing no fulfillment towards your request.
I don't think you've read your own post.
Quote

Bomb Bloke's Photo Bomb Bloke 21 Mar 2015

It's a bit of a moot point, considering that you can only upload / download ASCII.
Quote

Lupus590's Photo Lupus590 21 Mar 2015

.tar.gz is a combined format the .gz provides compression

anyway, enough arguing.
Edited by Lupus590, 21 March 2015 - 10:28 AM.
Quote

CrazedProgrammer's Photo CrazedProgrammer 21 Mar 2015

 Bomb Bloke, on 21 March 2015 - 01:48 AM, said:

It's a bit of a moot point, considering that you can only upload / download ASCII.
It converts binary data to base64 so you can upload everything to pastebin.
Quote

Bomb Bloke's Photo Bomb Bloke 21 Mar 2015

That's great and all, but then what are you going to do - paste that content into your compression software of choice? ;)

You'll need a go-between converter, so it doesn't matter so much as to whether the pre-base64'd file uses a "standard" format or not.
Quote

CrazedProgrammer's Photo CrazedProgrammer 21 Mar 2015

I've updated Packager to use LZW compression and a more efficient way to make directories and files, and this can make the output file sometimes even smaller than the directory you compress.
To download it use the same command as before:
pastebin get Wy5vb6p0 packager
The usage is also exactly the same, you just see the difference in size.
Screenshot:
Spoiler
Quote

minebuild02's Photo minebuild02 25 Mar 2015

Can I use this in my OS?
Quote

CrazedProgrammer's Photo CrazedProgrammer 25 Mar 2015

 minebuild02, on 25 March 2015 - 09:17 AM, said:

Can I use this in my OS?
Of course :D
This program was made for those kinds of things.
Quote

Creator's Photo Creator 29 Mar 2015

Packager 70: too long without yielding.

The folder I was trying to compress is this one.

If you want to get the folder structure, type this:

pastebin run 2DMDuHci TheOS

~Creator
Quote