Zlib

A

Andreas Schrafl

I want to compress a some files in a directory and move them to one
file. It is for a database and the compression type is zip. so now what
I don't know is how to zip more than one file. what is the seperator of
a file in zip? as I can input more a stream of a file (string) it is
easy to zip one file but several? I found a way but that is by bypassing
the command to the console and execute tar. this is not a nice way and I
want to avoid it if possible.

if somebody already had this problem and knows an answer or just has a
creative idea I would be very pleased to know it.

thanks
andy
 
A

Andreas Schrafl

Are you sure you mean 'zip' files and not 'gzip' files? They are very
different.

I just got a comment that says it has more than one file in these files
and so I tought of zip but probably tar.gz would be the best format.
'zip' files are multi-component archives (originating from the DOS
world as'pkzip'). I didn't think that ruby-zlib could create them.

'gzip' compresses a single stream. It is possible to concatenate
several gzip files just by putting them one after the other, but when
you decompress it you'll just back a single stream. It's up to you to
put your own demarcation between files, gzip just sees it all as a
stream of bytes.

< as I can input more a stream of a file (string) it is

'tar', 'cpio' and 'zip' are three separate command-line tools which
generate three different types of multi-file archive. I think that if
you already have several files in a directory, then calling one of
these external programs is the easiest way to create one of these
archives.

I notice in RAA a module 'tarsimple' which can generate tar files, but
I think it just calls the external command anyway.

I think I'll use the tarsimple module since this gives me a nice looking
interface.

Thanks
andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top