Page 1 of 1
decompress
Posted: Tue Jul 31, 2007 7:07 pm
by Andycal
Anyone know of an example using the decompress function to extract data from a gzip file? Looked at the examples in the docs and I just can't get it to work.
Posted: Tue Jul 31, 2007 7:44 pm
by Mark
Dear Andycal,
You can read the data from a file in the oldfashioned way:
Code: Select all
put "~/desktop/file.gz" into myFile
open file myFile for binary read
read from file myFile until EOF
close file myFile
put decompress(it) into myData
or use the url form:
Code: Select all
put "~/desktop/file.gz" into myFile
put decompress(URL ("binfile:" & myFile)) into myData
Best,
Mark
Posted: Tue Jul 31, 2007 7:48 pm
by Andycal
Hi Mark,
It's getting clearer, but what is the 'myData' variable? Does this put it somewhere on the disk?
Sorry if it's a stupid question, I'm still getting to grips with syntax in RunRev.
Posted: Tue Jul 31, 2007 7:56 pm
by Mark
Dear Andycal,
The variable myData only contains the result of the decompress() function. It contains data. If you want these data to be written back to disk, you have to use the write command or use the put url command.
Best,
Mark
Posted: Tue Jul 31, 2007 7:58 pm
by Andycal
Gotcha! Thanks Mark, I'll go play...