Storing compressed data: tidbit

FlexibleLearning at aol.com FlexibleLearning at aol.com
Mon Jan 12 02:45:56 EST 2004


-- These allow compressed data to be stored in a password-protected stack...

I recently asked if RR still corrupts compressed data when stored in a 
password-protected stack. Assuming this remains the case, the solution is to encode 
the compressed data which, although making the compressed data a bit bigger, 
does at least avoid invalid data problems...

function compressAlt tData
  put compress(tData) into dummy
  return base64Encode(dummy)
end compressAlt

function decompressAlt tData
  put base64Decode(tData) into dummy
  return decompress(dummy)
end decompressAlt

eg
- set the MyDataFile of this stack to compressAlt(url("binfile:"&tPath))
- put decompressAlt(the MyDataFile of this stack) into url ("binfile:"&tPath)


Splitting the command into two lines does appear to be required. Usng a 
one-liner like "return base64Encode(compress(tData))" does not always work.


Hope someone may find this useful.

/H


More information about the use-livecode mailing list