[REBOL] Re: Compression
From: agem:crosswinds at: 27-Jun-2001 14:36
RE: [REBOL] Re: Compression
[louisaturk--eudoramail--com] wrote:
> Hi Brett,
>
> Thanks for the response.
>
> It might be the second possibility. If I type the following at the command
> prompt it works:
>
> write/binary %data.r decompress read/binary %/a/data.r
>
> If compress/decompress is used for every write, then performance will be
> affected. I just want to compress the data so that more will fit on a
> floppy disk for backup purposes. I don't want the database compressed
> during ordinary usage. How do I get around this problem?
>
add some little bytes at the start which tells if file is compressed.
something like:
read-db: does[
data: read/binary %/a/data.r
parse/all data [copy type to ":" copy data to end]
if "compressed:" = type [data: decompress data]
]
write-db: does[
write/binary %data.r join "uncompressed:" data
]
write-db-compressed: does[
write/binary %data.r join "compressed:" compress data
]
write-db-compressed read-db