API Data File Save as proper format

Greetings,

I’m trying to get some data from CouchDB and apparently I have a lot of files that come as Attachments but in a weird way.

So I have as identification :

"mainUti": "com.apple.rtfd", "name": "test.rtfd",

In postman I get the details from the file as XML format apparently, but when I look to the data of the attachment I get the following

PK ?M as Header

Then the content where I see some names .rtfd and other extensions between the encoded data and in the end , the last line I get

PKp?+eArchive created with ZipKit

From what I found on the internet apparently they are some .ZIP files, any idea how to save this as a proper format and to be able to get the proper data from them ?

Do I use TextOutputStream, do I use BinaryStream, do I use something else ? and how if possible.

Thank you.

You can use TextOutputStream to write binary data, so either will work…

For the file format, you will get more onformation here:
https://en.wikipedia.org/wiki/Zip_(file_format)

in your case (this file), rtfd is a rtf file (so text) with image; so a folder with a file called TXT.rtf and one or more images files.

As you said, this is a zip file.

To read it, use BinaryStream. But, look at the wikipedia article and decide what you want to do.