compress: unexpected end of file on Mac

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
giansuana
Posts: 16
Joined: Sat Mar 19, 2011 7:11 am

compress: unexpected end of file on Mac

Post by giansuana » Sat Aug 13, 2011 10:07 am

Hi,
if I use the command 'compress' in a LC script to save a zipped file onto my Mac's disk (OSX Lion), I afterwards get an error trying to uncompress this file.
Terminal is telling me: 'gzip: Blah.gz: unexpected end of file'.
If I upload the same zipped file to a ftp server in my LC script and then do a download with my Mac's ftp client, uncompressing works great! :?:

What's different between saving directly to hard drive and do the loop over a ftp server ? Or other question: how can I prevent this 'unexpected end of file' ? For saving I use the following commands in my script:

Code: Select all

put tFile into the URL("file:Blah.gz") //saving on disk
put tFile into URL "ftp://ftp.xyz.com/Blah.gz" //saving on ftp
Best regards,
Gian.

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: compress: unexpected end of file on Mac

Post by Klaus » Sat Aug 13, 2011 11:01 am

Hi Gian,

you need to save this as BINFILE on disk!
...
put tFile into the URL("BINFILE:Blah.gz") //saving on disk
...


Best

Klaus

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: compress: unexpected end of file on Mac

Post by bn » Sat Aug 13, 2011 11:01 am

Hi Gian,

I tried with "binfile:" instead of "file:" as this is binary data and using "file:" there is a conversion of line endings according to the platform

Code: Select all

on mouseUp
   put "/Users/userName/Desktop/44px-G-clef.svg.png" into tFile
   put tFile & ".gz" into tExportFile
   put compress (url ("binfile:" & tFile)) into url ("binfile:" & tExportFile)
end mouseUp
this produced a functional compressed file of the origingal file on MacOSX 10.6.8 (Snow Leopard)

could you try this?

Why it works with the ftp-ed version I have no idea.
Edit: probably there is no conversion of line endings when saving to ftp url, would not make sense in this context.

Kind regards

Bernd

Edit: Hi Klaus

giansuana
Posts: 16
Joined: Sat Mar 19, 2011 7:11 am

Re: compress: unexpected end of file on Mac

Post by giansuana » Sat Aug 13, 2011 2:52 pm

Hi all,
'binfile' instead of 'file' works! Thank you al lot for your help!

Best regards,
Gian.

Post Reply