MacGapProject / MacGap1

Desktop WebKit wrapper for HTML/CSS/JS applications.
Other
3.55k stars 209 forks source link

Downloading files? #36

Closed rafabernad closed 12 years ago

rafabernad commented 12 years ago

Hi all,

First, great work! I would like to use macgap with an app that needs to download files. The idea is to use the webview cookies to request a file, and save it to the hard disk, but I don't see any function exposed to perform such task. It's possible to do this with the current implementation of macgap?

maccman commented 12 years ago

You could probably use Ajax.

rafabernad commented 12 years ago

Yeah, but that's a problem for binary files, and saving them to disk. That's why I ask about this.

maccman commented 12 years ago

Can you use an array buffer? https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest#Handling_binary_data

rafabernad commented 12 years ago

Yes, I can use it to read the files, but I don't see how I'm going to save them to disk, which is the final goal.

maccman commented 12 years ago

Ah, I see. Unfortunately, while Chrome has support for writing files natively, I don't believe Safari does. You might want to check out this branch of macgap: https://github.com/maccman/macgap/pull/25

rafabernad commented 12 years ago

Thanks, but that seems to be for reading files from the disk.

I've found that phonegap folks provide download methods: http://groups.google.com/group/phonegap/browse_thread/thread/dc345ab942813733

It could be easy for someone with zero knowledge of Obj-C to port that over macgap?