[REBOL] Re: saving file from detach.r
From: brett:codeconscious at: 16-Jun-2001 1:38
Hi,
I've done quite a number of changes since I made that script and I have some
new scripts to replace it.
This deals with mime type messages.
http://www.codeconscious.com/rebol-library/mime-model.r
This deals with uuencoding and quoted-printable encoding.
http://www.codeconscious.com/rebol-library/encodings.r
This is the main script it calls the other two. It provides a function
called
attachments?
.
http://www.codeconscious.com/rebol-library/inetmsg-model.r
Here are some examples.
Text file attachments ( indicates a space):
>> r: attachments? read %test.eml
== [%New Text Document.txt "text/plain" "this is a test^/"
%Copy of New Text Document.txt "text/pl
ain" "this is a test^...
Image attachments:
>> r: attachments? read %test2.eml
== [%test.jpg "image/jpeg" #{
FFD8FFE000104A46494600010001004800480000FFFE001F4C45414420546563
686E6F6C6F6769657320496E632E2056...
In this last example if I wanted to save the image I would use
write/binary r/1 r/3
If I wanted to view the image using rebol view I would use
view layout [image load r/3]
The load converts the binary to an image! datatype. This works for View but
not Core 2.5 which is one reason I don't do it within mime-model.r.
The other being that the write/binary would fail on the image! datatype.
Regards,
Brett.
Librarian comment
Brett has an updated set of tools for dealing with mime encoded files at CodeConscious