This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Help with script to parse a text-file compressed with gz

Old posts that have not been replied to for several years.
Locked
F
FAIN
Voice
Posts: 1
Joined: Fri Aug 29, 2003 8:25 pm

Help with script to parse a text-file compressed with gz

Post by FAIN »

I'm trying to write a script for my eggdrop bot to parse a textfile that is compressed with gzip but can't get it to work.

I'm currently using the http package with the following code:

Code: Select all

set page [::http::geturl ${temp_URL}]
set lines [split [::http::data ${page}] \n]
set numLines [llength ${lines}]
Then I just parse it a line by a line with a for loop but the problem is that I just get junk from it since it's compressed. I've looked at the compress module some but not quite sure how to use it in this case.

Any help would be appreciated!
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

What are you trying to do? You first must download the file, unpack then view it. This should save the file:

Code: Select all

package require http

set f [open "some.file.tgz" w]
::http::geturl "http://somepage/some.file.tgz" -channel $f
close $f
if that's what you are looking for.
Once the game is over, the king and the pawn go back in the same box.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

you need the mkZiplib extension, which will allow you to decompress your data on-the-fly
Locked