Working with Base64 and Mac files

Richard Gaskin ambassador at fourthworld.com
Fri Aug 16 00:48:00 EDT 2002


Matt Denton writes:

> I've got a small app working that updates various components of itself,
> using an update sequence file to download the latest bits via HTTP off
> the web.  Works a treat!
> 
> I've converted it from FTP to HTTP, which seems fine, however I have had
> some problems with Base64 and Mac files: sometimes they work (Rev and
> Acrobat) sometimes they don't (usually when an Application file).   I'm
> assuming this is because some Mac files have a Resource fork and the
> base64 encode only encodes the data fork, is that correct?
> 
> So my question is: how do I encode a Mac file, have it on an HTTP
> Server, then get it back whole and intact?  I looked up 'copyResource'
> etc, but no luck. I was thinking to GZIP it first, then Base64 after...
> will this preserve the Resource Fork?

This will get the resource fork data:

  put url ("resfile:"&tLocalFilePath) into tResDataVar

This will restore it to a file:

  put tResDataVar into url ("resfile:"& tLocalFilePath)

The compress and uncompress functions are great.  In my tests here gzip
seems quite efficient:  on text it often reduces the data size to about 30%
of the original.

-- 
 Richard Gaskin 
 Fourth World Media Corporation
 Custom Software and Web Development for All Major Platforms
 Developer of WebMerge 2.0: Publish any Database on Any Site
 ___________________________________________________________
 Ambassador at FourthWorld.com       http://www.FourthWorld.com
 Tel: 323-225-3717                       AIM: FourthWorldInc




More information about the use-livecode mailing list